Problem 20

Problem 20

URL problem: https://projecteuler.net/problem=20

n means n ×! (n - 1) × ... × 3 × 2 × 1 
factorial
! the For Example, 10 = 10. 9 × × × 2 × ... ×. 3. 1 = 3628800,
and The SUM of digits in The Number 10 The!. 3 + IS + 2. 8. 6 + + + 0 + 0. 8 = 27. A

the find The SUM The Number of The digits in 100!
find 100! The results and the results of all the numbers are added, the resulting figures is how much?
tot = 1
for i in range(1, 101):
    tot *= i
print(tot)
sum = 0
for i in str(tot):
    sum += int(i)
print(sum)

 

Guess you like

Origin www.cnblogs.com/noonjuan/p/10963310.html