| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哎,wa了好多次,改提交c++就过了,高人帮我看看为什么#include <cstdio>
#include <cmath>
#define PI 3.141592653589
int main()
{
double N;
double radius;
while(scanf("%lf%lf",&N,&radius)!=EOF)
{
double x,y,topx,topy;
scanf("%lf%lf",&topx,&topy);
x=topx,y=topy;
double ans=2*PI*radius;
for (int i=1;i<N;++i)
{
double a,b;
scanf("%lf%lf",&a,&b);
ans+=sqrt((a-x)*(a-x)+(b-y)*(b-y));
x=a,y=b;
}
ans+=sqrt((x-topx)*(x-topx)+(y-topy)*(y-topy));
printf("%.2lf\n",ans);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator