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

crash(access violation)
Posted by hello_world_ww 13 Nov 2012 19:27
test #9  crash(access violation)

double..[65536]

????
who can help me??
Re: crash(access violation)
Posted by hello_world_ww 13 Nov 2012 19:32
oh....it's my code

int main(void)
{
     double number,root,temp,answer[65536];
     int i=0;
     while(EOF!=scanf("%lf",&number))
     {
         if(number==0) root=0;
         else
         {
             root=1;
             temp=(root+number/root)/2;
             while(root!=temp)
             {
                 root=temp;
                 temp=(root+number/root)/2;
             }
         }
         answer[i++]=root;
     }
     for(i-=1;i>=0;i--) printf("%.4lf\n",answer[i]);
     return 0;
 }
Re: crash(access violation)
Posted by Smilodon_am [Obninsk INPE] 14 Nov 2012 17:57
hello_world_ww wrote 13 November 2012 19:32
     double number,root,temp,answer[65536];

Size of test is not more than 256 KB. If each number consists from only one digit and there are blank spaces between numbers so no more than 131072 numbers could be in one test, not 65536.
Re: crash(access violation)
Posted by hello_world_ww 17 Nov 2012 07:17
oh,thanks!I got it!