結果

問題 No.542 1円玉と5円玉
ユーザー 2329 N2329 N
提出日時 2020-09-04 23:48:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 514 bytes
コンパイル時間 133 ms
コンパイル使用メモリ 10,684 KB
実行使用メモリ 8,548 KB
最終ジャッジ日時 2023-08-17 20:54:24
合計ジャッジ時間 1,243 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,740 KB
testcase_01 AC 16 ms
7,840 KB
testcase_02 AC 16 ms
7,760 KB
testcase_03 AC 17 ms
7,832 KB
testcase_04 AC 17 ms
7,836 KB
testcase_05 AC 16 ms
7,812 KB
testcase_06 AC 16 ms
7,792 KB
testcase_07 AC 16 ms
7,908 KB
testcase_08 AC 17 ms
7,812 KB
testcase_09 AC 17 ms
7,736 KB
testcase_10 AC 16 ms
7,760 KB
testcase_11 AC 16 ms
7,836 KB
testcase_12 AC 18 ms
8,548 KB
権限があれば一括ダウンロードができます

ソースコード

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