結果

問題 No.542 1円玉と5円玉
ユーザー 2329 N
提出日時 2020-09-04 23:48:57
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 481 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,136 KB
最終ジャッジ日時 2024-11-26 21:09:08
合計ジャッジ時間 1,426 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b = map(int, input().split())

m = [1 * i for i in range(1, a + 1)]#1円で作れる金額リスト
M = [5 * i for i in range(1, b + 1)]#5円で作れる金額リスト

l_1 = len(m)#1円で作れる金額の種類
l_5 = len(M)#5円で作れる金額の種類

#1円と5円を組み合わせて作れる金額リスト
x = []

for k in range(l_1):
    x.extend([m[k] + M[j] for j in range(l_5)])

ans = list(set(m + M + x))#作れる金額の重複をリストから除く
ans.sort()

for i in ans:
    print(i)
0