結果

問題 No.542 1円玉と5円玉
ユーザー GrayCoderGrayCoder
提出日時 2017-07-14 23:03:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 428 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 18,432 KB
最終ジャッジ日時 2024-04-16 20:29:57
合計ジャッジ時間 3,848 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
16,128 KB
testcase_01 AC 31 ms
10,496 KB
testcase_02 AC 34 ms
10,496 KB
testcase_03 AC 32 ms
10,496 KB
testcase_04 AC 59 ms
10,880 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

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