- 54.04%
- 1000ms
- 262144K
N! 末尾有多少个 0 呢?
N!=1×2×⋯×N。
#include <iostream>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
while (n) {
ans +=n/=5;
}
cout << ans << endl;
return 0;
}
N! 末尾有多少个 0 呢?
N!=1×2×⋯×N。
#include <iostream>
using namespace std;
int main() {
int n, ans = 0;
cin >> n;
while (n) {
ans +=n/=5;
}
cout << ans << endl;
return 0;
}