0%

[題解]CSES 1618 Trailing Zeros

Trailing Zeros

題目連結

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <bits/stdc++.h>
#define int long long
#define N 1000005
#define mod 1000000007
using namespace std;
int n;

void solve(){
int f = 5,ans = 0;
for(int i=0;i<12;i++){
ans += n / f;
f *= 5;
}
cout<<ans<<"\n";
}

signed main(){
cin>>n;
solve();
return 0;
}