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

why am I WA?(C)
Posted by dubowen91 19 Jan 2008 20:53
#include<stdio.h>
#include<math.h>
int main()
{double a[10000];
 int n;
 for(n=1;scanf("%lf",&a[n])!=EOF;n++);
 for(;n>=1;n--)
 {a[n]=sqrt(a[n]);
 printf("%0.4lf\n",a[n]);
 }
 return 0;
}
Re: why am I WA?(C)
Posted by dubowen91 20 Jan 2008 19:12
NO one can tall me that?
what should I do?
Re: why am I WA?(C)
Posted by Ivanov Alexander 21 Jan 2008 20:38
Маловато наверно будет 10000.
У меня была размерность больше 100 тыщ...
Re: why am I WA?(C)
Posted by Romko [Lviv NU] 23 Jan 2008 01:33
You should change size of your array...
Re: why am I WA?(C)
Posted by wwwwwwking 2 May 2008 08:26
I think you should use stack,
Re: why am I WA?(C)
Posted by HJ 8 Jun 2008 20:30
Just one more semicolon(;).

for(n=1;scanf("%lf",&a[n])!=EOF;n++);
Re: why am I WA?(C)
Posted by Lee Chan 8 Jun 2008 21:57
scanf return the number of fields successfully converted and assigned; the return value does not include fields that were read but not assigned. A return value of 0 indicates that no fields were assigned. The return value is EOF for an error or if the end-of-file character or the end-of-string character is encountered in the first attempt to read a character.according to compilor,the result of EOF can be -1.each number or character that you input from the keyboard is ASCII,so the sentence "for(n=1;scanf("%lf",&a[n])!=EOF;n++);" would never be ended.