-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA.cpp
40 lines (40 loc) · 889 Bytes
/
A.cpp
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 t,a,b;
scanf("%lld",&t);
while(t--)
{
scanf("%lld%lld",&a,&b);
if(a==0 || b==0)
printf("0\n");
else
{
if(a>=b)
{
if((a+b)/3>b)
{
if(a/2<b)
printf("%lld\n",a/2);
else
printf("%lld\n",b);
}
else
printf("%lld\n",(a+b)/3);
}
else
{
if((a+b)/3>a)
{
if(b/2<a)
printf("%lld\n",b/2);
else
printf("%lld\n",a);
}
else
printf("%lld\n",(a+b)/3);
}
}
}
return 0;
}