https://www.codechef.com/submit/CNOTE

What’s wrong in the code

#include<bits/stdc++.h>
using namespace std;
void method()
{
int x,y,k,n;
int p,c,found=0;
cin>>x;
cin>>y;
cin>>k;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>p>>c;
if(y+p>=x && c<=k)
found=1;
}
if(found==1)
cout<<“LuckyChef”;
else
cout<<“UnluckyChef”;

}

int main() {
int t;
cin>>t;
for(int i=0;i<t;i++)
{ method();}

return 0;

}

1 Like

https://www.codechef.com/viewsolution/25509558
Anyway,
I debugged your code and you can check your solution
All i did was add a ‘\n’ in your code.
But anyway your approach is correct and you did a silly mistake that’s all.
Next time, however ask the question in following format:
Topic
“question link”
“submission link”
that’s all!
Cause otherwise, others will take time in reading the code and also it’s always better to code using proper indentation and it makes it look neat! :smile:

2 Likes