Hi!
Can anybody give me some critical test? I don't know why WA.
[pascal]
{$A+,B-,C+,D-,E-,F-,G+,H+,I-,J-,K-,L-,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+}
Program Problem10088 (input, output);
{$APPTYPE CONSOLE}
Type
TPoint = Record
X,Y: Int64;
end;
Var
P: Array [0..1000] of TPoint;
S: Double;
i,PA,N: Integer;
Function Square(N: Integer): Double;
Var
i: Integer;
S: Int64;
Begin
S:=0;
for i:=1 to N do
S:=S+P
.X*(P[(i+1) mod N].Y-P[(i-1) mod N].Y);
Result:=Abs(S/2);
end;
Function PointAmount(Const A,B: TPoint): Integer;
Var
dx,dy,min,max: Integer;
Begin
dx:=Abs(A.X-B.X);
dy:=Abs(A.Y-B.Y);
if dx < dy then
Begin
min:=dx;
max:=dy;
end
else
Begin
min:=dy;
max:=dx;
end;
if min = 0 then
Result:=max-1
else
if max mod min = 0 then
Result:=min-1
else
Result:=0;
end;
Begin
ReadLn(N);
While N <> 0 do
Begin
for i:=0 to N-1 do
With P do
ReadLn(X,Y);
S:=Square(N);
PA:=N;
for i:=1 to N do
Inc(PA,PointAmount(P,P[(i+1) mod N]));
WriteLn(S-PA/2+1:0:0);
ReadLn(N);
end;
end.
[/pascal]