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

Why?? Memory limit exceeded?? #7
Posted by Thien Diep 25 Jun 2012 21:53
Memory limit exceeded    #7    time = 1.312    Memory used = 20 620 KB.
Why memory used too much???? :((


#include <iostream>
#include <math.h>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std;

string d2s(double x)
{
    stringstream ii;
    ii << fixed << setprecision(4) << x;
    return ii.str();
}

int main( )
{
    double n;
        string s = "";
    while ((cin >> n))
    {
          s = d2s(sqrt(n)) + "\n" + s;
    }
    cout << s;

    return 0;
}