Skip to content

Commit b460459

Browse files
committed
Solve 1429 - Factorial Again! in python
1 parent 86beec3 commit b460459

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

solutions/beecrowd/1429/1429.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import math
2+
import sys
3+
4+
input = sys.stdin.readline
5+
output = sys.stdout.write
6+
7+
while line := input().strip():
8+
if line == '0':
9+
break
10+
11+
t = len(line)
12+
i = 0
13+
s = 0
14+
15+
for character in line:
16+
s += int(character) * math.factorial(t)
17+
i += 1
18+
t -= 1
19+
20+
output(f'{s}\n')

0 commit comments

Comments
 (0)