Problem | Verdict | Lang | Time | Best | Rank | Submit Time |
---|---|---|---|---|---|---|
| discuss324 - | Accepted | Python | 0.020 | 0.000 | 3662 | 1 mins ago |
Suggest:
- BigNumber (so we should code python to easy)
def f(n):
if n == 0:
return 1
else:
return n * f(n - 1)
while True:
n = int(input())
if n == 0:
break
cnt = {'0': 0, '1': 0, '2': 0, '3': 0, '4': 0, '5': 0, '6': 0, '7': 0, '8': 0, '9': 0}
for c in str(f(n)):
cnt[c] += 1
print(f"{n}! --")
print(f" ({0}){cnt[str(0)]:>5}", end="")
for i in range(1, 5):
print(f" ({i}){cnt[str(i)]:>5}", end="")
print()
print(f" ({5}){cnt[str(5)]:>5}", end="")
for i in range(6, 10):
print(f" ({i}){cnt[str(i)]:>5}", end="")
print()
No comments:
Post a Comment