ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1726. Visits

Why isn't my solution working?
Posted by NikolaV994 26 Nov 2011 15:26
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.