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

THis is supposed to work. What is wrong?
Posted by Luigi Brito 23 Mar 2014 00:01
#include <stdio.h>
#include <math.h>
main()
{
    int a=0;
    float b=0;
    while (!feof(stdin))
{
   scanf("%d", &a);
   b=sqrt(a);
   if (feof(stdin))
   printf("%.4f\n",b);

}
}


It works fine at my PC. But it keeps saying wrong answer?
Re: THis is supposed to work. What is wrong?
Posted by Luigi Brito 23 Mar 2014 00:05
#include <stdio.h>
#include <math.h>
main()
{
    int a=0;
    float b=0;
    while (!feof(stdin))
{
   scanf("%d", &a);
   b=sqrt(a);
   printf("%.4f\n",b);
}
}
Re: THis is supposed to work. What is wrong?
Posted by GastonFontenla 15 Jul 2015 11:29
You should use a long long data type, because the int type supports only 2^32 as max. Please, read the contraints of the problem. There says that the number could be as big as 10^18 (a lot bigger than 2^32). Try with long long. Hope it be useful for you.