結果

問題 No.542 1円玉と5円玉
ユーザー GrayCoder
提出日時 2017-07-14 23:03:55
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 428 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 19,876 KB
最終ジャッジ日時 2024-10-07 23:26:23
合計ジャッジ時間 4,105 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 2 TLE * 1 -- * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    A, B = map(int, input().split())

    coin = [1] * A
    coin += [5] * B

    comb = []
    price = 0
    mask = 0
    n = A + B
    while mask < (1<<(n)):
        i = 0
        while i < n:
            if mask & (1<<i):
                price += coin[i]
            i += 1
        comb.append(price)
        price = 0
        mask += 1

    ans = sorted(set(comb[1:]))
    for i in ans:
        print(i)

main()
0