- 绕钉子的长绳子
- 2016-05-14 10:52:45 @
记录信息
评测状态 Accepted
题目 P1007 绕钉子的长绳子
递交时间 2016-05-14 10:52:10
代码语言 C++
评测机 ShadowShore
消耗时间 0 ms
消耗内存 504 KiB
评测时间 2016-05-14 10:52:11
评测结果
编译成功
测试数据 #0: Accepted, time = 0 ms, mem = 504 KiB, score = 10
测试数据 #1: Accepted, time = 0 ms, mem = 504 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 504 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 500 KiB, score = 10
测试数据 #4: Accepted, time = 0 ms, mem = 504 KiB, score = 10
测试数据 #5: Accepted, time = 0 ms, mem = 500 KiB, score = 10
Accepted, time = 0 ms, mem = 504 KiB, score = 60
代码
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int n;
float a[101][3],ans=0,r;
scanf("%d %f\n",&n,&r);
for(int i=1;i<=n;i++)
scanf("%f %f",&a[i][1],&a[i][2]);
for(int i=1;i<n;i++)
ans+=sqrt((a[i][1]-a[i+1][1])*(a[i][1]-a[i+1][1])+(a[i][2]-a[i+1][2])*(a[i][2]-a[i+1][2]));
ans+=sqrt((a[n][1]-a[1][1])*(a[n][1]-a[1][1])+(a[n][2]-a[1][2])*(a[n][2]-a[1][2]));
printf("%.2f",ans+r*2*3.1415926);
return 0;
}
0 条评论
目前还没有评论...