码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 1142 Factorial ( 算术基本定理 + 分解N! )

时间:2014-10-30 11:33:39      阅读:236      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   color   os   ar   sp   strong   

 

HDU 1142 Factorial ( 算术基本定理 + 分解N! )

bubuko.com,布布扣

 

 

bubuko.com,布布扣
#include <cstdio>

int main()
{
    int t, n;
    scanf( "%d", &t );
    while( t-- )
    {
        scanf( "%d", &n );
        int cnt = 0;
        while( n )
        {
            cnt += n/5;
            n /= 5;
        }        
        printf( "%d\n", cnt ); 
    }    
    return 0;
}
代码君

 

HDU 1142 Factorial ( 算术基本定理 + 分解N! )

标签:style   blog   http   io   color   os   ar   sp   strong   

原文地址:http://www.cnblogs.com/BigBallon/p/4062107.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!