結果

問題 No.542 1円玉と5円玉
コンテスト
ユーザー mosmos_21
提出日時 2017-07-14 22:28:26
言語 Java
(openjdk 25.0.2)
コンパイル:
javac -encoding UTF8 _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true _class_
結果
WA  
実行時間 -
コード長 677 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,434 ms
コンパイル使用メモリ 83,308 KB
実行使用メモリ 46,528 KB
最終ジャッジ日時 2026-04-24 09:09:01
合計ジャッジ時間 3,640 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.HashSet;
import java.util.Scanner;

public class Main {
    Scanner in = new Scanner(System.in);

    public void solve() {
        int a = in.nextInt(), b = in.nextInt();
        HashSet<Integer> set = new HashSet<>();

        for (int i = 0; i <= a; i++) {
            for (int j = 0; j <= b; j++) {
                set.add(i + j * 5);
            }
        }
        Integer[] list = new Integer[set.size()];
        set.toArray(list);
        for (int i = 0; i < list.length; i++) {
            if (list[i] != 0)
                System.out.println(list[i]);
        }
    }

    public static void main(String[] args) {
        new Main().solve();
    }
}
0