My issue
when I use float in place of double for g, I get the wrong answer. please explain
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
float a,b,c,d;
cin>>a>>b>>c>>d;
float e=a*b*c*d;
float f=100/e;
int p=100*f;
int t=1000*f;
int u=t-10*p;
double g=1.0*p/100;
if(u<5)
g=g;
else
g=g+0.01;
if(g==9.58)
cout<<"NO"<<endl;
else if(g<9.58)
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
}
Problem Link: World Record Practice Coding Problem