|
|
вернуться в форумMy code gets WA, any help appreciated Послано Daniel 2 авг 2002 21:07 #include <stdio.h> #include <math.h> int main() { float ans,r,x[100], y[100]; int n,i; scanf("%d %f", &n, &r); for (i = 0; i < n; i++) scanf("%f %f", &x[i], &y [i]); ans = 2*r*3.14159; if (n > 1) { for (i = 0; i < n-1; i++) ans += sqrt( (x[i]-x[i+1])*(x[i]-x[i+1]) + (y[i]-y[i+1]) * (y [i]-y[i+1])); ans += sqrt( (x[n]-x[1])*(x[n]-x[1]) + (y[n]-y[1]) * (y[n]-y [1])); } printf("%.2f\n", ans); return 0; } |
|
|