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

Output seem to match the expectation but still the solution is rejected
Posted by ktm 28 Aug 2015 20:58
Can someone please tell me the problem with this code. It looks okay to me.
Environment: Linux, G++ C++11, GCC version 4.9.2

#include <cmath>
#include <iostream>
#include <iomanip>
#include <vector>
#include <sstream>
#include <ios>
#include <string>

using namespace std;

int main(void)
{
        vector<long long> v;

        string strBuf;
        long long result;
        while (getline(cin, strBuf)) {
                result = atoll(strBuf.c_str());
                v.push_back(result);
        }

        vector<long long>::reverse_iterator ritr = v.rbegin();
        while (ritr != v.rend()) {
                cout << fixed  << setprecision(4) << sqrtl(*ritr) << endl;
                ++ritr;
        }

        return 0;
}

Compilation:
$ g++ ktm_0_1.cpp -std=c++11

Sample execution seems fine to me:
$ ./a.out
 1427  0

   876652098643267843
5276538 <-- After this, I enter CTRL-D manually
2297.0716
936297014.1164
0.0000
37.7757