結果

問題 No.542 1円玉と5円玉
ユーザー Pump0129Pump0129
提出日時 2018-03-26 19:10:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 908 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 84,632 KB
実行使用メモリ 58,412 KB
最終ジャッジ日時 2023-09-07 12:47:00
合計ジャッジ時間 5,184 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,948 KB
testcase_01 AC 124 ms
56,004 KB
testcase_02 AC 126 ms
56,000 KB
testcase_03 AC 121 ms
55,684 KB
testcase_04 AC 123 ms
55,324 KB
testcase_05 AC 144 ms
55,920 KB
testcase_06 AC 151 ms
56,020 KB
testcase_07 AC 155 ms
55,792 KB
testcase_08 AC 155 ms
58,412 KB
testcase_09 AC 142 ms
56,280 KB
testcase_10 AC 121 ms
56,444 KB
testcase_11 AC 125 ms
55,320 KB
testcase_12 AC 169 ms
56,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package net.ipipip0129.yukicoder.no542;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String line = scan.nextLine();
		scan.close();
		
		int yen1count = Integer.parseInt(line.split(" ")[0]);
		int yen5count = Integer.parseInt(line.split(" ")[1]);
		
		List<Integer> yenlist = new ArrayList<Integer>();
		
		for (int i = 1; i <= yen1count; i++) {
			yenlist.add(i);
		}
		
		for (int j = 1; j <= yen5count; j++) {
			yenlist.add(j * 5);
			for (int i = 1; i <= yen1count; i++) {
				yenlist.add((j * 5) + i);
			}
		}
		
		yenlist = new ArrayList<Integer>(new HashSet<>(yenlist));
		
		Collections.sort(yenlist);
		
		yenlist.stream().forEach(i -> System.out.println(i));
	}
}
0