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#3
Posted by VladimirZagorodskih 28 Feb 2010 10:57
I couldn't understand my mistake! On my tests it works correct.



program project1;
var
  n, i : longint;
  r, res, x, y, x1, y1, x0, y0 : extended;
begin
{$IFNDEF ONLINE_JUDGE}
   assign(input, 'input.txt');
   assign(output, 'output.txt');
   reset(input);
   rewrite(output);
{$ENDIF}
  readln(n, r);
  readln(x, y);
  x0:=x;
  y0:=y;
  res:=2*pi*r;
  for i:=1 to n-1 do begin
    readln(x1, y1);
    res:=res+sqrt(sqr(x1-x)+sqr(y1-y));
    y:=y1;
    x:=x1;
  end;
  res:=trunc(res*100)/100;
  write((res+sqrt(sqr(x1-x0)+sqr(y1-y0))):1:2);
{$IFNDEF ONLINE_JUDGE}
   close(input);
   close(output);
{$ENDIF}
end.
Re: WA#3
Posted by Petrova Valentina [USU] 3 Mar 2011 23:46
I've got the same problem=) May be there is a mistake with counting doubles (extended) and printing the answer... I suppose

Edited by author 03.03.2011 23:46

Edited by author 03.03.2011 23:47
Re: WA#3
Posted by SpartakusMd 20 Mar 2012 04:17
On the test 3 n=1, so you need to print the perimeter of nail.
Good luck
Re: WA#3
Posted by Mehedi Imam Shafi 26 Sep 2016 10:51
SpartakusMd wrote 20 March 2012 04:17
On the test 3 n=1, so you need to print the perimeter of nail.
Good luck
thanks helped
Re: WA#3
Posted by Mozammal Hossain 15 Mar 2019 02:18
for n=1,r=1.
What will be the answer? is there any effect on axes position?