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

What's wrong with my code on C(and me)?
Posted by Dark_Mind 16 Oct 2016 00:41
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)?
Posted by ToadMonster 16 Oct 2016 01:13
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)?
Posted by Dark_Mind 16 Oct 2016 12:46
1)Thank you! Ofc, lld for long long...
2)Yes, its just a test.