結果

問題 No.542 1円玉と5円玉
ユーザー samplelpmas
提出日時 2017-07-16 06:47:46
言語 Java
(openjdk 23)
結果
AC  
実行時間 179 ms / 2,000 ms
コード長 597 bytes
コンパイル時間 2,213 ms
コンパイル使用メモリ 78,196 KB
実行使用メモリ 54,428 KB
最終ジャッジ日時 2024-10-08 03:37:19
合計ジャッジ時間 5,284 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int oneYenCoins = sc.nextInt();
        int fiveYenCoins = sc.nextInt();

        Set<Integer> set = new TreeSet<Integer>();

        for (int i = 0; i <= oneYenCoins; i++) {

            for (int j = 0; j <= fiveYenCoins; j++) {

                set.add(j * 5 + i);

            }

        }

        set.remove(0);

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

    }

}
0