贴50pts暴力
有没有O(1)的办法
#include<iostream>
#define ll long long
using namespace std;
ll n,k,q,r;
int main() {
int T;
cin>>T;
while(T--) {
ll ans=0;
cin>>n>>k;
if(k==0){
cout<<1<<endl;
continue;
}
for(q=1; q<=n/k+1; q++) {
r=n-q*k;
if(r>=0&&n/q==k&&n%q==r) {
ans++;
}
}
cout<<ans<<endl;
}
return 0;
}