|
|
back to board#include <iostream> #include <math.h> using namespace std; void square() { long long int n; scanf("%lld", &n); if(n!=-1) { square(); printf("%.4f\n", sqrt(n)); } return; } int main() { square(); return 0; } http://acm.timus.ru/help.aspx?topic=cpp&locale=en Visual C++ Only. In order to increase the size of a stack and to avoid its overflow when using a “deep” recursion, you should use a special directive (in the example, the size of the stack is set to be 16 MB): #pragma comment(linker, "/STACK:16777216") sorry i don't understand .. how to set the size of the stack??? If you can explain... it might help me..... #pragma comment(linker, "/STACK:16777216") Put the line above in the very beginning of your program, that all. You shouldn't touch stack size at all. You shouldn't implement algorithms with linear depth of recursion, not more then logarithmic depth. You shouldn't place big arrays/objects on stack. Imagine you have 1-2K stack at all. You should get/implement stack data structure and solve problem using it. |
|
|