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

HELP ME!!! What's wrong with it? (C++)
Posted by lem_TOJ 23 May 2014 07:22
#include <iostream>
#include <math.h>
#include <vector>
#include <stdio.h>
using namespace std;
int main() {
    unsigned long long  a;
    vector<unsigned long long> b;
    cin.clear();
    while(cin>>a,!cin.eof()) {
            b.push_back(a);
    }
    for(vector<unsigned long long>::iterator it = b.begin() ; it != b.end(); ++it) {
        printf("%.4lld\n", sqrt(*it));
    }
    return 0;
}

Edited by author 23.05.2014 07:23

Edited by author 23.05.2014 07:23
Re: HELP ME!!! What's wrong with it? (C++)
Posted by stepanovep 1 Dec 2014 01:51
It seems that you print numbers to right order,
you should print them to reverse order.
Like this:

    for (vector<...> : reverse_iterator it = b.rbegin(); it != b.rend(); ++t)
       ...