Advertisement
add1ctus

Untitled

Mar 6th, 2015
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. bool solve(int needed, int n, int money)
  6. {
  7.     bool solveable=false;
  8.     while(n--)
  9.     {
  10.         int pi,ci;
  11.         cin>>pi>>ci;
  12.         if(pi>=needed && money>=ci)
  13.             solveable=true;
  14.     }
  15.     return solveable;
  16. }
  17.  
  18. int main()
  19. {
  20.     int t;
  21.     cin>>t;
  22.     while(t--)
  23.     {
  24.         int x,y,k,n;
  25.         cin>>x>>y>>k>>n;
  26.         if(solve(x-y,n,k))
  27.             cout<<"LuckyChef"<<endl;
  28.         else
  29.             cout<<"UnluckyChef"<<endl;
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement