結果
問題 | No.542 1円玉と5円玉 |
ユーザー |
![]() |
提出日時 | 2017-07-14 22:27:28 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 169 ms / 2,000 ms |
コード長 | 644 bytes |
コンパイル時間 | 2,180 ms |
コンパイル使用メモリ | 76,672 KB |
実行使用メモリ | 42,020 KB |
最終ジャッジ日時 | 2024-10-07 23:05:55 |
合計ジャッジ時間 | 4,970 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); int b = sc.nextInt(); HashSet<Integer> set = new HashSet<Integer>(); for(int i = 0; i <= a; i++) { for(int j = 0; j <= b; j++) { if((i != 0) || (j != 0)) set.add(i + 5 * j); } } ArrayList<Integer> list = new ArrayList<Integer>(); Iterator<Integer> it = set.iterator(); while(it.hasNext()) { list.add(it.next()); } Collections.sort(list); for(int i = 0; i < list.size(); i++) { System.out.println(list.get(i)); } } }