|
|
вернуться в форумWrong answer for C Послано kc2uno 30 май 2011 11:23 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <math.h> 4 5 int main() 6 { 7 double m=pow(10,18); 8 9 long int arr[131072]; 10 int count=0,i; 11 12 long int d; 13 while(scanf("%ld",&d)!=EOF) 14 { 15 arr[count++]=d; 16 } 17 18 for(i=count-1;i>=0;i--) 19 { 20 double val=(double)arr[i]; 21 printf("%.4f\n",val>m?0:sqrt(val)); 22 } 23 24 return 0; 25 } I tried it with the input they gave for the example and it worked. Could someone point out what could be wrong with it? Re: Wrong answer for C why you checking for m ? I think better remove it printf("%.4f\n" ... try \r\n instead of \n |
|
|