|
|
вернуться в форумWhy is WA for Test 9? Pls. Help me. Послано logic 21 авг 2008 13:36 #include<stdio.h> #include<math.h> int main() { double a[100000]; signed long int i = 0; while (scanf("%lf", &a[i]) != EOF) { i++; } i--; while ( i >= 0) { printf("%.4lf\n",sqrt(a[i])); i--; } return ; } Re: Why is WA for Test 9? Pls. Help me. !!!!!EXTENDED for Pascal!!!!!! !!!!!LONG DOUBLE for C++!!!!!! Re: Why is WA for Test 9? Pls. Help me. try this: double a [128*1024] Re: Why is WA for Test 9? Pls. Help me. use dinamic memory try double *a = (double *) malloc (sizeof(double)*128*1024); and when you done before return free (a); thats all :) Re: Why is WA for Test 9? Pls. Help me. Послано fa2f 20 дек 2008 00:37 Aleksa_Markoni, thank you! Re: Why is WA for Test 9? Pls. Help me. Could you tell me why it should use dinamic memory ? Thank you! Re: Why is WA for Test 9? Pls. Help me. There is no need to use dinamic memory ... Just make sure that your array is large enough. But I wonder why the result I get is TLE ... this is my code: #include<stdio.h> #include<string.h> #include<math.h> double a[100010];//make it larger and then I got AC int main() { int k=0; while(scanf("%lf",&a[k])!=EOF)k++; while(k) printf("%.4lf\n",sqrt(a[--k])); return 0; } use dinamic memory try double *a = (double *) malloc (sizeof(double)*128*1024); and when you done before return free (a); thats all :) Re: Why is WA for Test 9? Pls. Help me. Edited by author 21.10.2009 00:40 Re: Why is WA for Test 9? Pls. Help me. while your program submit it replies Time limit exceeded for what reason? |
|
|