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

RickyCloud Please Help(C++) [4] // Problem 1001. Reverse Root 23 Dec 2020 21:32
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
    long long val = 0;
    vector<double> v;
    while (cin >> val &&val!=EOF)
    {
        v.push_back(sqrt(val));
    }
    for (int i = v.size()-1; i >=0; i--)
    {
        cout<< v[i] << endl;
    }
    return 0;
}
Levon Oganesyan Re: Please Help(C++) // Problem 1001. Reverse Root 24 Dec 2020 03:04
Set your val type to double
Arman Sykot Re: Please Help(C++) [1] // Problem 1001. Reverse Root 6 Jan 2021 23:19
for (int i = v.size()-1; i >=0; i--)
    {
        cout << fixed << setprecision(4) << v[i] << endl;
    }

use this. your program is supposed to print 4 points
AaBbCc Re: Please Help(C++) // Problem 1001. Reverse Root 20 Oct 2021 12:17
for (int i = v.size()-1; i >=0; i--)
    {
        cout << ios::fixed << setprecision(4) << v[i] << endl;
    }
zkv Re: Please Help(C++) // Problem 1001. Reverse Root 29 Aug 2021 17:20
try to change "long long val" to "double val"