Euler Project question 31 in python way
# This python file uses the following encoding: utf-8
# In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:
# 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
# It is possible to make £2 in the following way:
# 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
# How many different ways can £2 be made using any number of coins?
import time
start = time.time()
print "%s ways was found in %s seconds" % (4 + 2*len([(i, j, k, l, m) for i in range(0, 51) for j in range(0, 26) for k in range(0, 11) for l in range(0, 6) for m in range(0, 3) if i*1 + j*2 + k*5 + l*10 + m*20 == 50]) + 2*len([(i, j, k, l, m) for i in range(0, 101) for j in range(0, 51) for k in range(0, 21) for l in range(0, 11) for m in range(0, 6) if i*1 + j*2 + k*5 + l*10 + m*20 == 100]) + len([(i, j, k, l, m) for i in range(0, 151) for j in range(0, 76) for k in range(0, 31) for l in range(0, 16) for m in range(0, 8) if i*1 + j*2 + k*5 + l*10 + m*20 == 150]) + len([(i, j, k, l, m) for i in range(0, 201) for j in range(0, 101) for k in range(0, 41) for l in range(0, 21) for m in range(0, 11) if i*1 + j*2 + k*5 + l*10 + m*20 == 200]), time.time() - start)
just too long, nees some improvement