思路:
代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline ll read(){ll x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}
void solve(){
ll x=read(),y=read();
ll res=0;
for(ll k=1;k*k<x;k++)//这里判断条件取等其实也能ac
res=res+max(0ll,min(y,x/k-1)-k);
printf("%lld\n",res);
}
int main(){
int T=read();
while(T--) solve();
return 0;
}