HDU 2601 An easy problem

(i+1)*(j+1)=n+1

转换成上面这个式子,也就是问n+1的因子有几个

#include<cstdio>

#include<cstring>

#include<cmath>

#include<algorithm>

using namespace std;



int main()

{

    int T;

    scanf("%d",&T);

    while(T--)

    {

        long long n,y,i;

        scanf("%lld",&n);

        n++;

        int anss=0;

        y=sqrt(1.0*n);

        for(i=2;i<=y;i++)

            if(n%i==0)

                anss++;

        printf("%d\n",anss);

    }

    return 0;

}

 

你可能感兴趣的:(HDU)