# Help me in solving MONSTER1 problem

### My code

``````#include <iostream>
using namespace std;
int main (){
int t;
cin>>t;
while(t--){
int h,x,y;
cin>>h>>x>>y;
int p=h=y-x;

if(p<=0){
cout<<"1"<<endl;
}
else{
cout<<"0"<<endl;
}
}
return 0;
}
``````

Problem Link: CodeChef: Practical coding for everyone

@deepanshu_2004
The logic i used in this question was like this;

Monster has H health points, it gains Y (Rate of gain) before a hit and loses X (Rate of loss) after every hit.

If the rate of health loss is greater than rate of health gain, it can be defeated.

Case 1: Rate of gain is more than or equal to rate of loss. (Y>=X).

Here, it is impossible to defeat the monster as its health point will either always be increasing or be constant.

Case2: Rate of gain is lower than rate of loss. (Y<X) or ((X-Y)>0)

Here, the monster will keep losing some health point at every strike and after a while its health H will reach zero. Thus, it is possible to defeat the monster.

``````if(y>=x):
print(0)
else:
print(1)
``````

To add to this, in your if condition, you are using a break statement which will force the control out of loop, so not all test cases would be checked.