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

whats wrong here please ?
Posted by MyName 21 Jul 2015 17:00
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <sstream>
#include <vector>
#include <stdio.h>

using namespace std;

int main()
{
    string s="";
    vector <long double> vec;

    cout<<vec.size();
    long double j;
    char c;
    stringstream ss("");
    for (int i=0;i<256000;i++)//This is here so I can handle the size of the stream input
    {
        cin.get(c);
        s+=c;
    }
    //Now I know I am working on 256KB
    ss<<s;

    while(ss>>j)
    {
        j=sqrt(j);

        vec.push_back(j);
    }

    for (int k=vec.size()-1;k>=0;k--)
    {
        cout.precision(4);
        cout<<fixed<<vec[k]<<endl;
    }

    return 0;
}
Re: whats wrong here please ?
Posted by MyName 21 Jul 2015 18:24
I should add a test, if we are in the end of file before the 256000. Otherwise, it'll wait for 256000 char to enter