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

Anonymous Wrong Answer Test #1 (C++) [1] // Problem 1001. Reverse Root 8 Jul 2014 16:40
Can anyone tell me what's wrong with the code? I have tested it for many times, and it works completely fine. But the online judge keeps telling me wrong answer.

Code:
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main()
{
    double a[128];
    double tmp = 0;
    int cnt = 0;

    while(!cin.eof())
    {
        cin >> a[cnt];
        cnt += 1;
    }

    cout << setprecision(4) << fixed;

    for(int i = cnt - 1;i >= 0;i -= 1)
    {
        tmp = sqrt(a[i]);
        cout << tmp << endl;
    }

    return 0;
}
Кадырбек Re: Wrong Answer Test #1 (C++) // Problem 1001. Reverse Root 17 Aug 2014 22:47
dont use cin.eof(), acm.timus cant check that, just use while(cin>>a[cnt])