Could someone help to point out where is my code wrong for problem https://www.spoj.com/problems/BESTTWO/?
It returns “wrong answer” when i submit it. But it works fine on ideone (https://ideone.com/mw9aOR).
#include
using namespace std;
int main() {
// your code here
int n = 0;
float a, b, c, temp;
scanf("%d", &n);
for (int i=0; i<n; i ++) {
scanf("%f %f %f", &a, &b, &c);
// sort a, b, c
if(a>b) temp=a,a=b,b=temp;
if(b>c) temp=b,b=c,c=temp;
if(a>b) temp=a,a=b,b=temp;
if (b >= 10)
printf("%.2f\n", (b+c)/2.0);
else
printf("Failed\n");
}
return 0;
}