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

What wrong?
Posted by Cross 29 Jan 2011 17:08
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

type coord = record
  x:real;
  y:real;
end;

var
  count,i:integer;
  radius,p,y:real;
  coordinats:array of coord;
begin
  y:=0;
  read(count,radius);
  SetLength(coordinats,count+1);
  for i:= 1 to count do
    begin
      read(coordinats[i].X,coordinats[i].Y);
    end;
  p:=2*pi*radius;
  for i:= 1 to count do
    begin
      if(i = count)then
        y:=sqrt((coordinats[i].x-coordinats[0].x)*(coordinats[i].x-coordinats[0].x)+(coordinats[i].y-coordinats[0].y)*(coordinats[i].y-coordinats[0].y))
      else
        y:=sqrt((coordinats[i].x-coordinats[i+1].x)*(coordinats[i].x-coordinats[i+1].x)+(coordinats[i].y-coordinats[i+1].y)*(coordinats[i].y-coordinats[i+1].y));
      p:=p+y;
    end;
  writeln(p:0:2);
  readln;readln;
end.