結果

問題 No.542 1円玉と5円玉
ユーザー tsunabittsunabit
提出日時 2019-06-16 18:49:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 3,474 ms
コンパイル使用メモリ 72,912 KB
実行使用メモリ 56,468 KB
最終ジャッジ日時 2023-08-16 03:14:42
合計ジャッジ時間 6,422 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
56,032 KB
testcase_01 AC 116 ms
55,532 KB
testcase_02 AC 112 ms
55,832 KB
testcase_03 AC 118 ms
55,972 KB
testcase_04 AC 114 ms
55,628 KB
testcase_05 AC 130 ms
55,980 KB
testcase_06 AC 136 ms
55,984 KB
testcase_07 AC 132 ms
55,620 KB
testcase_08 AC 150 ms
56,336 KB
testcase_09 AC 133 ms
56,468 KB
testcase_10 AC 117 ms
55,964 KB
testcase_11 AC 120 ms
55,716 KB
testcase_12 AC 171 ms
56,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No542 {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int a = sc.nextInt(), b = sc.nextInt();
    	
    	HashSet<Integer> hs = new HashSet<Integer>();
    	for(int i = 0; i <= a; i++) {
    		for(int j = 0; j <= b; j++) {
    			hs.add(i + (j * 5));
    		}
    	}
    	ArrayList<Integer> k = new ArrayList<Integer>();
    	for(int h : hs) {
    		k.add(h);
    	}
    	Collections.sort(k);
    	k.remove(0);
    	
    	for(int f : k) {
    		System.out.println(f);
    	}
    }
}
0