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

What is wrong ? (C++)
Posted by PimpMyTest 26 Jan 2015 16:44
// The code compiles and works fine. (It expects Ctrl+Z to stop user's input).

#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>::reverse_iterator it = b.rbegin(); it != b.rend(); ++it){
        printf("%.4f\n", sqrt((long double)*it));

    }

    return 0;

}
Re: What is wrong ? (C++)
Posted by Михаил 29 Jan 2015 17:14
x   Y       u
Re: What is wrong ? (C++)
Posted by Михаил 29 Jan 2015 17:14
x   Y       u
Re: What is wrong ? (C++)
Posted by ochuikin 8 Apr 2015 18:04
#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 ) {
        b.push_back(a);
        if (cin.eof()) break;
    }

    for (vector<unsigned long long>::reverse_iterator it = b.rbegin(); it != b.rend(); ++it){
        printf("%.4f\n", sqrt((long double)*it));

    }

    return 0;

}