- /*
- 这段代码为什么不能AC呢?大神们帮忙看看哪里出问题了
- */
- #include <stdio.h>
- #include <stdlib.h>
- int main(void)
- {
- long n,a=1,k,j=1,t=1,s=1;
- int i;
- while(scanf("%ld%ld",&n,&a)!=EOF)
- {
- for(i=1;i<=n;++i)
- {
- n*=i;
- }
- for(k=1;(n%t==0&&n%s!=0);k++)
- {
- while(j<=k)
- {
- t*=a;
- s=t*a;
- }
- }
- printf("%ld\\n",k);
- }
- return 0;
- }
- //该片段来自于http://www.codesnippet.cn/detail/2208201410296.html
来源: http://www.codesnippet.cn/detail/2208201410296.html