|
|
back to boardDiscussion of Problem 1020. RopeWA on test 2,plz help ! #include<stdio.h> #include<math.h> #define PI acos(-1) int main() { int N,i; double r; scanf("%d%lf",&N,&r); double xx,yy,cx,cy,fx,fy,sum=0,tsum=0,y,x,z; y=2*r; x=PI*r/2.0; z=N*(y-x); scanf("%lf%lf",&xx,&yy); fx=xx; fy=yy; for(i=2;i<=N;i++) { scanf("%lf%lf",&cx,&cy); sum=y+sum+sqrt((xx-cx)*(xx-cx)+(yy-cy)*(yy-cy)); xx=cx; yy=cy; if(i==N) { sum=y+sum+sqrt((xx-fx)*(xx-fx)+(yy-fy)*(yy-fy)); break; } } tsum=sum-z; printf("%.2lf\n",tsum); return 0; } Re: WA on test 2,plz help ! what is the test 2..? |
|
|