HDU 1142 Factorial ( 算术基本定理 + 分解N! )
#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; }
代码君
时间: 2024-10-08 23:06:35
HDU 1142 Factorial ( 算术基本定理 + 分解N! )
#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; }
代码君