ENG  RUS Timus 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

why show me wrong answer for this problem of 1001?? My compiler give me a right answer..
Posted by Amit_guha 27 Jul 2018 20:14
#include<bits/stdc++.h>
#include<math.h>
using namespace std;

int main()
{
long long int  i,j,k,s;
double a,b,c,d;
scanf("%lld %lld %lld %lld",&i,&j,&k,&s);
if(s>=0)
{
d=sqrt(s);
printf("%.4f\n",d);
}
if(k>=0)
{
c=sqrt(k);
printf("%.4f\n",c);
}
if(j>=0)
{
b=sqrt(j);
printf("%.4f\n",b);
}

if(i>=0)
{
a=sqrt(i);
printf("%.4f\n",a);
}

return 0;
}
Re: why show me wrong answer for this problem of 1001?? My compiler give me a right answer..
Posted by Orient 28 Jul 2018 12:30
Why do you think there are only four numbers in input? Why do you think a number can be negative?
Re: why show me wrong answer for this problem of 1001?? My compiler give me a right answer..
Posted by pizza_hunter 10 Mar 2019 13:16
If you are new to OJ system...
The point is, the system will input any case that satisfies its question, not only the sample input.
Therefore, there might not be only 4 numbers for you to consider. It may input 100 numbers, which your code obviously cannot give the correct output.