結果

問題 No.542 1円玉と5円玉
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-09-06 23:48:48
言語 Java21
(openjdk 21)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 828 bytes
コンパイル時間 3,034 ms
コンパイル使用メモリ 75,188 KB
実行使用メモリ 38,236 KB
最終ジャッジ日時 2024-04-24 15:24:43
合計ジャッジ時間 4,560 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
37,032 KB
testcase_01 AC 46 ms
36,688 KB
testcase_02 AC 45 ms
37,036 KB
testcase_03 AC 47 ms
36,820 KB
testcase_04 AC 46 ms
36,812 KB
testcase_05 AC 52 ms
37,072 KB
testcase_06 AC 70 ms
37,804 KB
testcase_07 AC 62 ms
37,560 KB
testcase_08 AC 68 ms
37,992 KB
testcase_09 AC 74 ms
37,540 KB
testcase_10 AC 48 ms
36,968 KB
testcase_11 AC 49 ms
37,196 KB
testcase_12 AC 76 ms
38,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedHashSet;
import java.util.Set;

import static java.lang.System.in;

public class No542 {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] inputs = reader.readLine().split(" ");

        int A = Integer.parseInt(inputs[0]);
        int B = Integer.parseInt(inputs[1]);

        Set set = new LinkedHashSet<Integer>();

        for (int b = 0; b <= B; b++) {
            for (int a = 0; a <= A; a++) {
                if (a + b > 0) {
                    set.add(a + b * 5);
                }

            }
        }

        for (Object s : set) {
            System.out.println(s);
        }
    }
}
0