結果

問題 No.542 1円玉と5円玉
ユーザー heyanxxheyanxx
提出日時 2019-07-05 09:16:15
言語 Java21
(openjdk 21)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 942 bytes
コンパイル時間 3,573 ms
コンパイル使用メモリ 78,588 KB
実行使用メモリ 55,308 KB
最終ジャッジ日時 2023-10-20 00:15:34
合計ジャッジ時間 5,179 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
53,540 KB
testcase_01 AC 52 ms
53,488 KB
testcase_02 AC 52 ms
53,548 KB
testcase_03 AC 53 ms
53,536 KB
testcase_04 AC 53 ms
53,544 KB
testcase_05 AC 74 ms
53,576 KB
testcase_06 AC 83 ms
53,576 KB
testcase_07 AC 85 ms
54,152 KB
testcase_08 AC 85 ms
54,392 KB
testcase_09 AC 88 ms
54,148 KB
testcase_10 AC 53 ms
53,544 KB
testcase_11 AC 55 ms
53,556 KB
testcase_12 AC 112 ms
55,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package test.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.TreeSet;

public class Yukicoder542 {

	public static void main(String[] args) throws IOException {
		// TODO 自動生成されたメソッド・スタブ
		
		String[]str=input();
		TreeSet<Integer>set=new TreeSet<Integer>();
		int A=Integer.parseInt(str[0]);
		int B=Integer.parseInt(str[1]);
		if(A!=0) {
			set.add(1);
		}else if(B!=0){
			set.add(5);
		}
		for(int i=1;i<=A;i++) {
			set.add(i);
		}
		for(int i=1;i<=B;i++) {
			for(int j=1;j<=A;j++) {
				set.add(j+i*5);
			}
			set.add(i*5);
		}
		for(int i:set) {
			System.out.println(i);
		}
		//System.out.println(set.toString());

	}
	public static  String[] input() throws IOException {
		BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
		
		String str=br.readLine();
		String[]str2=str.split(" ");
		
		return str2;
	}
}
0