标签:style blog http io ar color os sp for
给定两个数m,n,其中m是一个素数。
将n(0<=n<=10000)的阶乘分解质因数,求其中有多少个m。
2 100 5 16 2
24 15
#include<stdio.h>
int main()
{
int i,j,test,n,m,t,sum;
scanf("%d",&test);
while(test--)
{
scanf("%d %d",&n,&m);
for(i=m,sum=0;i<=n;i+=m)
{
for(j=1,t=i;!(t%m);j++)
{
t/=m;
sum++;
}
}
printf("%d\n",sum);
}
return 0;
}标签:style blog http io ar color os sp for
原文地址:http://blog.csdn.net/hdd871532887/article/details/41325333