| 3 | #include<stdio.h> |
| 4 | |
| 5 | int main(){ |
| 6 | |
| 7 | long int test; |
| 8 | long int power,health; |
| 9 | scanf("%ld",&test); |
| 10 | |
| 11 | while(test){ //for each test case |
| 12 | |
| 13 | scanf("%ld%ld",&health,&power); |
| 14 | |
| 15 | while(power>0){ //while power remains, perform the operations |
| 16 | |
| 17 | if((health-power)>0){ |
| 18 | |
| 19 | health-=power; //if health-power is > 0 then health can be reduced by power |
| 20 | |
| 21 | } |
| 22 | |
| 23 | else if((health-power)<=0){ |
| 24 | |
| 25 | health=0; //if health-power<=0 then it's obvious that Chef dies as he can't attack more |
| 26 | |
| 27 | break; |
| 28 | |
| 29 | } |
| 30 | |
| 31 | power=power/2; //power becomes half after each attack |
| 32 | |
| 33 | } |
| 34 | |
| 35 | if(health>0 && power==0) |
| 36 | printf("0\n"); //attack power becomes 0 so, chef will die hence we print 0 |
| 37 | |
| 38 | else if(health==0 && power>0) |
| 39 | printf("1\n"); //attack power is greater than 0 and health of Darth is equal to 0 hence Chef kills Darth, so, we print 1 |
| 40 | |
| 41 | --test; |
| 42 | |
| 43 | } |
| 44 | return 0; |
| 45 | } |
nothing calls this directly
no outgoing calls
no test coverage detected