|
|
back to boardwhy show me wrong answer for this problem of 1001?? My compiler give me a right answer.. #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.. 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. |
|
|