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

Please Help(C++)
Posted by RickyCloud 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;
}
Re: Please Help(C++)
Posted by Levon Oganesyan 24 Dec 2020 03:04
Set your val type to double
Re: Please Help(C++)
Posted by Arman Sykot 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
Re: Please Help(C++)
Posted by zkv 29 Aug 2021 17:20
try to change "long long val" to "double val"
Re: Please Help(C++)
Posted by AaBbCc 20 Oct 2021 12:17
for (int i = v.size()-1; i >=0; i--)
    {
        cout << ios::fixed << setprecision(4) << v[i] << endl;
    }