|
|
back to boardWhat's wrong with my code on C(and me)? My program answer true for input from example(for big number too), but i get "Wrong answer" on test 1. #include <stdio.h> #include <math.h> #define N 1000000 int main(int argc, char **argv) { long long int array[N]; int i=0; while (scanf("%Ld", &array[i])>0) { i++; } for(i-=1;i>=0;i--) printf("%.4f\n", sqrt(array[i])); return 0; } Re: What's wrong with my code on C(and me)? 1) Try scanf "%lld". 2) DONT try allocate such big arrays on stack. Place your array outside function/in heap/use vector Re: What's wrong with my code on C(and me)? 1)Thank you! Ofc, lld for long long... 2)Yes, its just a test. |
|
|