2016-09-07から1日間の記事一覧

千円札、五百円、百円硬貨を使って3000円を支払う方法は何通りあるか

detail.chiebukuro.yahoo.co.jp d.hatena.ne.jp 順列(再帰) def perm(head, money): coin = [100, 500, 1000] if money == 0: return [head] else: res = [] for i in coin: if money - i < 0: break headx = head + [i] res += perm(headx, money - i) re…