自己动手做网站教程/十大互联网平台
题目链接
这个题我是找规律做出来的,自己写了很多组数据,发现如果a,b的最小值比a-b的绝对值大 ,那么ans = (n+m)/3;否则ans = min(a,b);(本人比较菜,没什么好的方法)
#include <bits/stdc++.h>
#define ll long long
const int INF = 0x3f3f3f;
const int MAX = 1e5+10;
using namespace std;int main()
{ll t,n,m;cin>>t;while(t--){cin>>n>>m;ll t=min(n,m);ll p=abs(n-m);if(p<=t){cout<<(n+m)/3<<endl;}elsecout<<t<<endl;}return 0;
}