|
|
вернуться в форумWA #2 Послано h1ci 15 июн 2009 21:59 What is this test. What is my mistake #include <cstdio> #include <iostream> #include <cmath> using namespace std; int main() { int n; double r, a[128], b[128], P=0; scanf("%d%lf", &n, &r); for(int i=0; i<n; i++) { scanf("%lf%lf", &a[i], &b[i]); if(i>0) { P+=sqrt((a[i]-a[i-1])*(a[i]-a[i-1])+(b[i]-b[i-1])*(b[i]-b[i-1])); if(n==2) P+=sqrt((a[i]-a[i-1])*(a[i]-a[i-1])+(b[i]-b[i-1])*(b[i]-b[i-1])); } if(i==n-1) P+=sqrt((a[i]-a[0])*(a[i]-a[0])+(b[i]-b[0])*(b[i]-b[0])); } P+=2*r*acos(-1.0); printf("%4.2lf\n", P); }
Re: WA #2 - I saw my mistake AC now Послано h1ci 15 июн 2009 23:04 how to do it for 0,001 seconds???? |
|
|