結果

問題 No.542 1円玉と5円玉
ユーザー tsunabit
提出日時 2019-06-16 18:49:28
言語 Java
(openjdk 23)
結果
AC  
実行時間 161 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 3,208 ms
コンパイル使用メモリ 84,856 KB
実行使用メモリ 54,396 KB
最終ジャッジ日時 2024-11-24 12:46:09
合計ジャッジ時間 5,563 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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