|
|
back to boardDiscussion of Problem 1020. Ropeac program Posted by saba 3 Jun 2007 15:17 var n,i:integer; r:extended; a:array[1..100] of record x,y:extended; end; res:extended; begin read(n); read(r); res:=0; for i:=1 to n do Readln(a[i].x,a[i].y); for i:=2 to n do res:=res+sqrt(sqr(a[i].x-a[i-1].x)+sqr(a[i].y-a[i- 1].y)); res:=res+sqrt(sqr(a[n].x-a[1].x)+sqr(a[n].y-a[1].y)); res:=res+2*pi*r; writeln(res:0:2); end Re: ac program Tell me plz, why res:=res+2*pi*r ? Why not res:=res+(n-2)*pi*r for n>2 (n-2)*pi is a summ if angles Re: ac program With equal radii of the circles it is sufficient to add one circle size to the result (which is calculated as if we have dots instead of circles). It is easy provable so I will leave that to you. If we had circles with overlapping it would be much harder, however we don't so it works =) Edited by author 08.07.2007 20:37 |
|
|