結果

問題 No.542 1円玉と5円玉
ユーザー fkwnw3_1243
提出日時 2017-09-06 23:48:48
言語 Java
(openjdk 23)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 828 bytes
コンパイル時間 3,510 ms
コンパイル使用メモリ 75,308 KB
実行使用メモリ 38,304 KB
最終ジャッジ日時 2024-11-06 23:57:14
合計ジャッジ時間 5,077 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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