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

Crash (stack overflow). C++
Posted by Nikolay 26 Oct 2008 00:15
#include <stdio.h>
#include <math.h>
void main(){
    int i=0,j=0;
    double a[128*1024];
    while (scanf("%lf",&a[i])!=EOF) i++;
    for (j=i-1;j>=0;--j){
        printf("%.4lf\n",sqrt(double(a[j])));
    }
}
Re: Crash (stack overflow). C++
Posted by stepanov 26 Oct 2008 20:05
Use dynamic variable:
double *a;
a=new double[128*1024]
Re: Crash (stack overflow). C++
Posted by Michael Cheng 15 Mar 2009 09:03
I can confirm that stack size is 1024k.
To open a bigger array, you need to declare it global instead of in main.

Wasted me 45 mins
Re: Crash (stack overflow). C++
Posted by ahaxzh 4 Aug 2009 20:13
Think U!