結果

問題 No.542 1円玉と5円玉
ユーザー Pump0129Pump0129
提出日時 2018-03-26 19:10:22
言語 Java
(openjdk 23)
結果
AC  
実行時間 195 ms / 2,000 ms
コード長 908 bytes
コンパイル時間 2,559 ms
コンパイル使用メモリ 85,204 KB
実行使用メモリ 42,176 KB
最終ジャッジ日時 2024-06-25 06:51:05
合計ジャッジ時間 5,554 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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