結果

問題 No.542 1円玉と5円玉
ユーザー tanzakutanzaku
提出日時 2017-07-14 23:08:54
言語 Java
(openjdk 23)
結果
AC  
実行時間 172 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 3,757 ms
コンパイル使用メモリ 88,608 KB
実行使用メモリ 41,988 KB
最終ジャッジ日時 2024-10-07 23:30:50
合計ジャッジ時間 6,509 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class No543 {

	public static void main(String[] args) {
		try (final Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			Set<Integer> set = new TreeSet<>();
			for (int i = 0; i <= m; i++) {
				for (int j = 0; j <= n; j++) {
					set.add(i*5+j*1);
				}
			}
			set.remove(0);
			set.stream().forEach(System.out::println);
		}
	}
	
	static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n % r); }
	static long lcm(long n, long r) { return n/gcd(n,r)*r; }
	static void dump(Object... objects) { System.err.println(Arrays.deepToString(objects)); }
}
0