Hdu 4279 - Number

数论题,找规律

这题在航电上要用G++提交才能AC。。。坑爹!!

 

 

AC代码:

#include <stdio.h>
#include <math.h>
typedef __int64 ll;
ll x,y;
ll call(ll n)
{
    if(n<6) return 0;
    ll tp = (ll )sqrt(1.0*n);
    if(tp%2 == 1)
    {
        return (ll )(n/2)-1;
    }
    else
        return (ll )(n/2)-2;
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%I64d%I64d",&x,&y);
        printf("%I64d\n",call(y)-call(x-1));
    }
    return 0;
}

 

 


 

你可能感兴趣的:(Hdu 4279 - Number)