0052 - Factorial II
#include <iostream> using namespace std; void Slove(int n) { int count=0; while (n > 0) { count+=n/5; n/=5; } cout << count << endl; } int main(void) { int n; while (cin >> n && n) Slove(n); return 0; }
5で割った商を足していくと末尾の0の数になる。 (らしい