UVA 11461 - Square Numbers(水题)

时间:2024-03-31 11:05:14

题目链接

 #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <iostream>
using namespace std;
#define LL long long
#define MOD 1000000007
int p[];
int judge(int x)
{
int str,end,mid;
if(x <= )
return ;
str = ;
end = ;
while(str < end)
{
mid = (str + end + )/;
if(p[mid] > x)
end = mid - ;
else
str = mid;
}
return end;
}
int main()
{
int x,y,i;
for(i = ;i <= ;i ++)
p[i] = i*i;
while(scanf("%d%d",&x,&y)!=EOF)
{
if(x == &&y == ) break;
printf("%d\n",judge(y)-judge(x-));
}
return ;
}