|
|
back to boardWrong Answer Test #1 (C++) 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++) dont use cin.eof(), acm.timus cant check that, just use while(cin>>a[cnt]) |
|
|