Why the same solution a littile way different produces the wrong answer. i am so frustrated please help

I was participating in may lunchtime 2020 division and was working on LOSTWKND
my solution is :
int main() {
int test,A[5],P;
double sum;
cin>>test;
while(test–){
cin>>A[0]>>A[1]>>A[2]>>A[3]>>A[4]>>P;
sum=A[0]+A[1]+A[2]+A[3]+A[4];

    if( ((sum*P)/5.000000) <= 24.000000)
    {cout<<"NO\n";}
    else
    {cout<<"YES\n";}
}
return 0;

}
and the setter’s solution :
int main(){
ll t;
cin>>t;
while(t–){
ll a[5],p;
ll sum = 0;
for(ll i=0;i<5;i++){
cin>>a[i];
sum += a[i];
}
cin>>p;
if(sump > 245)
cout<<“Yes\n”;
else
cout<<“No\n”;
}
return 0;
}
is exactly the same but little different in condition but the overall meaning is the same , then why my code is wrong.

http://www.cs.technion.ac.il/users/yechiel/c++-faq/floating-point-arith.html

1 Like

I think your code didn’t worked because you are printing “NO” and “YES”. But we are supposed to print “No” and “Yes”.I tried by changing that part and your code worked.

1 Like

thankyou :smile:

oh this has to be the dumbest question asked of all time on codechef . thank you