|
|
back to boardDiscussion of Problem 1020. RopeNow I get WA!?!?!? HELP PLEASE!!! In Visual C++ there is now constant pi, so I use constant from Builder5 pi=3.14159265358979323846. I also tryed 2*acos(0) but still WA. Someone please help me if you can. #include <iostream.h> #include <math.h> #define pi 3.14159265358979323846 void main(){ int N, R; cin>>N>>R; int i; double t1_x, t2_x, tf_x, t1_y, t2_y, tf_y; cin>>tf_x>>tf_y; t1_x=tf_x; t1_y=tf_y; double sum_l=0; for(i=1; i<N; i++){ cin>>t2_x>>t2_y; sum_l+=sqrt((t2_x-t1_x)*(t2_x-t1_x)+(t2_y-t1_y)*(t2_y-t1_y)); t1_x=t2_x; t1_y=t2_y; } if (N>1) sum_l+=sqrt((t2_x-tf_x)*(t2_x-tf_x)+(t2_y-tf_y)*(t2_y-tf_y)); int sum=int((sum_l+2*R*pi)*100); cout<<double(sum)/100; } Re: Now I get WA!?!?!? HELP PLEASE!!! Posted by kap 28 Mar 2005 05:28 You should also remember about additional length of rope: rope doesn't have only one common point with nail (in general case)! |
|
|