|
|
вернуться в форумwhy it is wrong answer???sad... Послано xinxin 24 сен 2016 12:19 #include<stdio.h.> #include<string.h> #include<math.h> int main() { double len=0; int n,r,i,j; scanf("%d %d",&n,&r); double a[200][2]; for(i=0;i<n;i++) for(j=0;j<2;j++) scanf("%lf",&a[i][j]); for(i=1;i<n;i++) len=len+sqrt((a[i][1]-a[i-1][1])*(a[i][1]-a[i-1][1])+(a[i][0]-a[i-1][0])*(a[i][0]-a[i-1][0])); len=len+sqrt((a[i-1][1]-a[0][1])*(a[i-1][1]-a[0][1])+(a[i-1][0]-a[0][0])*(a[i-1][0]-a[0][0])); len=len+3.141*2*r; printf("%.2lf",len); fflush(stdin); getchar(); return 0; } Re: why it is wrong answer???sad... Послано V.Leo 10 окт 2016 09:40 I guess the 8th and 9th line. The value of radius is a real number instead of an integer, which is considered to be with decimal point. Thus "double r;" "scanf("%d %lf", ..)" maybe works. Re: why it is wrong answer???sad... Also note. Is pi=3.141 accurate enough? I used 3.14159 in my AC program |
|
|