|
|
back to boardShow all messages Hide all messagesHello. The 1001 problem is the third problem I attempted in this site and I am new here. I am not familiar with 64-bit compiler system. The code written by me resulted in a crash, so I need some help. I wrote the code as follows: #include<stdio.h> #include<math.h> int main() { unsigned long long a[32768]; long i=0; while(scanf("%I64u",&a[i])==1) i++; for(i=i-1;i>=0;i--) printf("%.4lf\n", sqrt(a[i])); return 0; } I do know there are some fatal faults....but I really need help. Thanks. "A size of the input stream does not exceed 256 KB". You have got crash because quantity of numbers can be greater than 32768. Then how can I determine the quantity? If the stream consists of 1 byte characters, and the integers are assumed to be 4 bytes, I need 256*1024/4=65536 membered array, right? #include<stdio.h> #include<math.h> #include<stdlib.h> double d[200000]; int main(){ long long l; int i=0; while( scanf("%lld",&l) != EOF ) d[i++]=sqrt(l); for(i-=1;i>=0;i--) printf("%.4lf\n",d[i]); return 0; } Please help getting WA |
|
|