Yes! I found why my submition gives WA - but can't understand why.
Yes! I found why my submition gives WA - but can't understand why.
Here is my WA solution:
program p1020;
var
i,n:integer;
r,res,a0,b0,a1,b1,a2,b2:double;
begin
read(n,r);
read(a1,b1);
res:=0.0; a0 := a1; b0:=b1;
for i:=1 to n-1 do
begin
readln(a2,b2);
res := res + sqrt((a2-a1)*(a2-a1)+(b2-b1)*(b2-b1));
a1 := a2; b1:=b2;
end;
res := res + sqrt((a2-a0)*(a2-a0)+(b2-b0)*(b2-b0));
res := res + 2*PI*r;
writeln(res:0:2);
end.
!!!! BUT when I change a line
res := res + sqrt((a2-a0)*(a2-a0)+(b2-b0)*(b2-b0));
to
res := res + sqrt((a1-a0)*(a1-a0)+(b1-b0)*(b1-b0));
I get ACCEPTED!!!
Tell me smb, WHY?????
TTTTTTTTTTttttthank YYYYYYYYYYYYYYYYou very much. I had made such a mistake!!!
Послано
Seany 6 авг 2003 17:50
> Try this input:
>
> 1 1
> 2 2
>
> Output should be 6.28, but your first program outputs 9.11