https://www.nowcoder.com/acm/contest/203/A
队友推得规律 看代码即可
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=1e5+10;
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
ll n,m;
scanf("%lld%lld",&n,&m);
n=abs(n),m=abs(m);
if(m>n)swap(n,m);
if(n==1&&m==0)
{
printf("3\n");
continue;
}
if(n==2&&m==2)
{
printf("4\n");
continue;
}
ll cz=n-m;
if(m>cz)
{
double kk=2.0*(floor((double)(cz-m)/3.0));
cz-=kk;
printf("%lld\n",cz);
}
else
{
double kk=2.0*(floor((double)(cz-m)/4.0));
cz-=kk;
printf("%lld\n",cz);
}
}
return 0;
}