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#include "stdio.h" #include "math.h" int main() { float N,R,a1,b1,a2,b2,l=0,i,m,n; scanf("%f %f",&N,&R); if(N==1) { scanf("%f %f",&m,&n); l=2*3.14*R; printf("%.2f\n",l);//是 0.00 还是 2 * 3.14 * R } else { scanf("%f %f",&a1,&b1); m=a1; n=b1; for(i=1;i<N;i++) { scanf("%f %f",&a2,&b2); l+=sqrt( (a1-a2)*(a1-a2) + (b1-b2)*(b1-b2) ); b1=b2; a1=a2; } l+=sqrt( (m-a2)*(m-a2) + (n-b2)*(n-b2) ); l=l+2*3.14*R;//-----加上园的周长 printf("%.2f\n",l); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator