aboutsummaryrefslogtreecommitdiff
path: root/cses/TrailingZeros/main.cpp
diff options
context:
space:
mode:
authoromagdy7 <omar.professional8777@gmail.com>2022-11-02 13:49:49 +0200
committeromagdy7 <omar.professional8777@gmail.com>2022-11-02 13:49:49 +0200
commit7c46e26fc0eea8ccbbd2fb22bd822bcf59dee563 (patch)
tree15fa612d6c9ad865b8aa1e5478c8dd76cf6365dd /cses/TrailingZeros/main.cpp
parent8ad882a1deea1ae012c6acf8810e3de9babca9f4 (diff)
downloadcompetitive-programming-7c46e26fc0eea8ccbbd2fb22bd822bcf59dee563.tar.xz
competitive-programming-7c46e26fc0eea8ccbbd2fb22bd822bcf59dee563.zip
Solved 1 problem from CSES
Diffstat (limited to 'cses/TrailingZeros/main.cpp')
-rw-r--r--cses/TrailingZeros/main.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/cses/TrailingZeros/main.cpp b/cses/TrailingZeros/main.cpp
new file mode 100644
index 0000000..e41854e
--- /dev/null
+++ b/cses/TrailingZeros/main.cpp
@@ -0,0 +1,15 @@
+#include<bits/stdc++.h>
+
+using namespace std;
+
+int main () {
+ ios_base::sync_with_stdio(false);
+ cin.tie(NULL);
+ int n;
+ cin >> n;
+ int ans = 0;
+ for (int i = 5; n >= i; i *= 5) {
+ ans += n / i;
+ }
+ cout << ans << '\n';
+}