ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1001. Reverse Root

Show all messages Hide all messages

Hello.
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.
Re: My program crashed and I don't understand 64 bit thing. Sergey Lazarev (MSU Tashkent) 16 Jul 2009 22:50
"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