A
ac代码
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int main()
{
IOS
int t;
cin>>t;
while(t--)
{
int ans=0;
int a,b;
cin>>a>>b;
if(b==0)
{
if(a%15==0) ans=a/15;
else ans=a/15+1;
}
else if(b!=0 && b%2==0)
{
if(a<=b/2*7) ans=b/2;
else{
if((a-(b/2*7))%15==0) ans=b/2+((a-b/2*7)/15);
else ans=b/2+((a-b/2*7)/15)+1;
}
//cout<<ans<<endl;
}
else if(b%2==1)
{
if(a<=(b/2*7+11)) ans=b/2+1;
else {
if((a-b/2*7-11)%15==0) ans=b/2+1+(a-b/2*7-11)/15;
else ans=b/2+1+(a-b/2*7-11)/15+1;
}
}
cout<<ans<<endl;
}
return 0;
}