码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 2601 An easy problem

时间:2015-07-15 20:45:35      阅读:135      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!