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

Grillepitch C++ Crash (stack overflow) [2] // Problem 1001. Reverse Root 21 Jul 2011 01:27
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main()
{
        long double array[128*1024];
    long double x = 0;
    int k = 0;
    while ( cin >> x )
    {
        array[k] = sqrt(x);
        ++k;
    }
    for ( int i = k-1; i >= 0; --i )
        cout << fixed << setprecision(4) << array[i] << endl;
    return 0;
}
hatred Re: C++ Crash (stack overflow) [1] // Problem 1001. Reverse Root 21 Jul 2011 01:52
try to define array in global namespace (not in main())
Grillepitch Re: C++ Crash (stack overflow) // Problem 1001. Reverse Root 21 Jul 2011 01:57
Thank you very much !