vijos_1007
绕钉子的长绳子-8min-模拟
Hint
注意到1个钉子的情况却漏考虑绕回第一个钉子时的长度,8分钟的时间有点慢。
?Download vijos_1007.pas
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | var n,i:longint; r,x0,y0,x,y,x1,y1,s:real; begin readln(n,r); readln(x0,y0); x:=x0; y:=y0; for i:=2 to n do begin readln(x1,y1); s:=s+sqrt((x1-x)*(x1-x)+(y1-y)*(y1-y)); x:=x1; y:=y1; end; s:=s+sqrt((x0-x)*(x0-x)+(y0-y)*(y0-y))+2*pi*r; writeln(s:0:2); end. |
编译通过…
├ 测试数据 01:答案正确… 0ms
├ 测试数据 02:答案正确… 0ms
├ 测试数据 03:答案正确… 0ms
├ 测试数据 04:答案正确… 0ms
├ 测试数据 05:答案正确… 0ms
├ 测试数据 06:答案正确… 0ms
————————-
Accepted 有效得分:100 有效耗时:0ms
最新评论