|
|
вернуться в форумWhy isn't my solution working? This is my first solution. I don't know if I am doing everything all right. I use the Free Pacal Compiler. Does the output of my solution have to be real, rounded to an integer, or just integer? This is my solution program Project2; var x,y:array[1..100000] of longint; r:array[1..100000] of longint; d:longint; n,i,j:longint; begin readln(n); for i:=1 to n do readln(x[i],y[i]); for i:=1 to n do r[i]:=0; for i:=1 to n do for j:=1 to n do if i<>j then r[i]:=r[i]+(abs(x[j]-x[i])+abs(y[j]-y[i])); d:=0; for i:=1 to n do begin r[i]:=r[i] div (n-1); d:=d+r[i] end; d:=d div n; writeln(d) end. |
|
|