HDU 1492 The number of divisors(约数) about Humble Numbers 水题

View Code
    #include<cstdio>
    #include<cstring>
    __int64 n, p, a[4] = {2, 3, 5, 7};
    int main()
    {
        int i, j;
        while( ~scanf("%I64d", &n) && n)
        {
            __int64 ans = 1;
            for(i = 0; i < 4; i++)
            {
                __int64 m = n; p = 0;
                while(m % a[i] == 0 && m)
                    m /= a[i], p++;
                ans *= (p + 1);
            }
            printf("%I64d\n", ans);
        }
        return 0;
    }

 

posted @ 2012-12-04 23:19  To be an ACMan  Views(156)  Comments(0)    收藏  举报