Created
July 21, 2012 13:52
-
-
Save iizukak/3155869 to your computer and use it in GitHub Desktop.
Project Euler Problem 20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #project euler problem 20 | |
| #http://projecteuler.net/problem=20 | |
| #auther @iizukak | |
| #100!の各桁を足す問題 | |
| def fact(n): | |
| if n == 2: | |
| return 2 | |
| else: | |
| return n * fact(n-1) | |
| a = fact(100) | |
| L = map((lambda x: int(x)), str(a)) | |
| ans = 0 | |
| for i in range(len(L)): | |
| ans += L[i] | |
| print ans |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment