Python Project Euler 013:100个50位数和
Problem 13
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
...(100个50位数)...
为了避免有后面低位进位的情况,取了每个50位数的前13位来运算。
1 def pe013BF(): 2 data = open('013.txt', "r") 3 sum1 = str(sum([int(line[:13]) for line in data]))[:10] 4 return sum1 5 6 if __name__ == '__main__': 7 result = pe013BF() 8 print(result)