-
Notifications
You must be signed in to change notification settings - Fork 0
/
C.c
55 lines (55 loc) · 944 Bytes
/
C.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include<stdio.h>
int main()
{
long long int n,m,ans;
scanf("%lld%lld",&n,&m);
/*if(n>=m)
{
if(m>=n/2)
{
if(n%2==0)
ans=n/2;
else
{
if(m-n/2>=2)
ans=n/2+1;
else
ans=n/2;
}
}
else
ans=m;
}
else
{
if(n>=m/2)
{
if(m%2==0)
ans=m/2;
else
{
if(n-m/2>=2)
ans=m/2+1;
else
ans=m/2;
}
}
else
ans=n;
}*/
if(m<(m+n)/3 && n<(m+n)/3)
{
if(m<=n)
ans=m;
else
ans=n;
}
else if(m<(m+n)/3)
ans=m;
else if(n<(m+n)/3)
ans=n;
else
ans=(m+n)/3;
printf("%lld\n",ans);
return 0;
}