http://acm.hdu.edu.cn/showproblem.php?pid=1492
计算约数的个数,由已知条件"A number whose only prime factors are 2,3,5 or 7 is called a humble number."简化运算。
View Code
#include <stdio.h> __int64 find(__int64 n,int a) { __int64 ans=0; while(1) { if(n==1)break; if(n%a==0) { ans++; n/=a; } else break; } return ans; } int main() { __int64 n,ans; int cnt1,cnt2,cnt3,cnt4; while(scanf("%I64d",&n),n) { cnt1=cnt2=cnt3=cnt4=1; cnt1+=find(n,2); cnt2+=find(n,3); cnt3+=find(n,5); cnt4+=find(n,7); ans=cnt1*cnt2*cnt3*cnt4; printf("%I64d\n",ans); } return 0; }