zoukankan      html  css  js  c++  java
  • 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
    ",anss);
        }
        return 0;
    }
  • 相关阅读:
    去重
    JavaScript 数组
    变量
    2017.3.19 for
    2017.3.19 if,for
    2017.3.14
    2017.3.10
    2017.3.9
    2017.3.7-1
    2017.3.7
  • 原文地址:https://www.cnblogs.com/zufezzt/p/4649291.html
Copyright © 2011-2022 走看看