From b79a55ceee2f4532ef6621f9d86c6c61543ce6c9 Mon Sep 17 00:00:00 2001 From: omagdy7 Date: Thu, 3 Nov 2022 19:21:07 +0200 Subject: Added some problems --- cses/IntroductoryProblems/TrailingZeros/test.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 cses/IntroductoryProblems/TrailingZeros/test.py (limited to 'cses/IntroductoryProblems/TrailingZeros/test.py') diff --git a/cses/IntroductoryProblems/TrailingZeros/test.py b/cses/IntroductoryProblems/TrailingZeros/test.py new file mode 100755 index 0000000..3f46e57 --- /dev/null +++ b/cses/IntroductoryProblems/TrailingZeros/test.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import sys + +sys.set_int_max_str_digits(16000) + +def fact(n): + ret = 1 + for i in range(1, n + 1): + ret *= i; + return ret + +def count_zeros(n): + ln = len(str(n)) + return ln - len(str(n).rstrip('0')) + +for i in range(1, 4001): + tmp = fact(i) + print(f"{i} : {count_zeros(tmp)} | {(i // 5) + (i // 25) + (i // 125)}") -- cgit v1.2.3