-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame.c
40 lines (38 loc) · 789 Bytes
/
game.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include<stdio.h>
int main(){
long long int x,i,a,b,t,h,arm;
scanf("%d",&x);
while(x--)
{
scanf("%d %d", &a, &b);
if(a==0||b==0)
puts("0");
else
{
t=1;
h=a+3;
arm=b+2;
while(1)
{
if(h>5&&arm>10)
{
h-=2;
arm-=8;
t+=2;
}
else if(h>20&&arm<=10)
{
h-=17;
arm+=7;
t+=2;
}
else
{
printf("%d\n",t);
break;
}
}
}
}
return 0;
}