結果

問題 No.542 1円玉と5円玉
ユーザー わらわら
提出日時 2020-12-11 00:05:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 612 bytes
コンパイル時間 2,409 ms
コンパイル使用メモリ 76,936 KB
実行使用メモリ 57,672 KB
最終ジャッジ日時 2023-10-20 01:04:07
合計ジャッジ時間 4,716 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
57,404 KB
testcase_01 AC 129 ms
57,644 KB
testcase_02 AC 127 ms
57,548 KB
testcase_03 AC 124 ms
57,552 KB
testcase_04 AC 117 ms
56,236 KB
testcase_05 AC 135 ms
57,544 KB
testcase_06 AC 139 ms
57,672 KB
testcase_07 AC 142 ms
57,636 KB
testcase_08 AC 145 ms
57,556 KB
testcase_09 AC 137 ms
57,604 KB
testcase_10 AC 127 ms
57,420 KB
testcase_11 AC 126 ms
57,468 KB
testcase_12 AC 146 ms
55,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        TreeSet<Integer> set = new TreeSet<>();
        for (int i = 0; i <= b; i++) {
            for (int j = 0; j <= a; j++) {
                set.add(i * 5 + j);
            }
        }

        // 合計値が0のものを排除s
        set.remove(0);
        StringBuilder sb = new StringBuilder();
        for (int x : set) {
            sb.append(x).append("\n");
        }
        System.out.print(sb);
    }
}
0