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 1020. Rope

WA! Please, tell me - what's wrong here
Posted by Michael Medvedev (KNU training center) 23 Apr 2003 16:32
I have changed a lot: readln to read, integer to longint, double to
erxtended. But get WA!

Please, tell me - what's wrong here. I want not to send accepted
program which is on the message board, but to understand my error.
Can I use any variable on Timus - like a, a0? Does sqrt work on Timus?
Does Pascal has constant PI?

Thanks for any help.

program p1020;
var
  i,n:longint;
  r,res,a0,b0,a1,b1,a2,b2:extended;
begin
  read(n,r);
  read(a1,b1);
  res := 2*PI*r; a0 := a1; b0:=b1;
  for i:=1 to n-1 do
  begin
    read(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));
  writeln(res:0:2);
end.