询问l,r区间的完全平方数的个数
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
long long a[1999999];
int main()
{
for(long long i=0;i<=999999;i++)
{
a[i-1] = i*i;
}
int n;
cin>>n;
int num = 0;
for(int i=1;i<=n;i++)
{
num = 0;
long long j = 0;
long long l,r;
scanf("%lld%lld",&l,&r);
int ll = lower_bound(a,a+999999,l)-a;
int rr = lower_bound(a,a+999999,r)-a;
// cout<<ll<<" "<<rr<<endl;
if(a[rr]==r)
rr++;
if(l==0)ll--;
rr--;
cout<<rr-ll+1<<endl;
}
return 0;
}