首页 > 其他 > 详细

HDU 2601 An easy problem

时间:2015-07-15 20:44:36      阅读:121      评论:0      收藏:0      [点我收藏+]

(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 2601 An easy problem

原文:http://www.cnblogs.com/zufezzt/p/4649291.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!