here’s my 1st solution:
int main() {
int t;
cin>>t;
while(t–)
{
ll int n,x,y,i,j,k,w,l,count,max=INT_MIN,min=INT_MAX;
cin>>x>>y>>k;
n=x+y;
w=ceil(n/float(k));
l=n/k;
if(n%k==0)
{
w=n/k;
if(!(w &1))
{ cout<<“Chef”<<endl;
}
else
{
cout<<“Paja”<<endl;
}
}
else
{
if(l%2==0)
{
cout<<“Chef”<<endl;
}
else
{
cout<<“Paja”<<endl;
}
}
}
return 0;
}
2nd solution:
int main() {
int t;
cin>>t;
while(t–)
{
ll int n,x,y,i,j,k,w,l,count,max=INT_MIN,min=INT_MAX;
cin>>x>>y>>k;
n=x+y;
w=ceil(n/float(k));
l=n/k;
if(n%k==0)
{
// w=n/k;
if(!(w &1))
{ cout<<“Chef”<<endl;
}
else
{
cout<<“Paja”<<endl;
}
}
else
{
if(l%2==0)
{
cout<<“Chef”<<endl;
}
else
{
cout<<“Paja”<<endl;
}
}
}
return 0;
}
my question is that why soltuion 1 gives AC and solution 2nd gave me WA… there only difference is comment in if condition… i highlighted for you…