結果

問題 No.542 1円玉と5円玉
ユーザー tanzakutanzaku
提出日時 2017-07-14 23:08:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 627 bytes
コンパイル時間 4,106 ms
コンパイル使用メモリ 88,320 KB
実行使用メモリ 41,956 KB
最終ジャッジ日時 2024-04-16 20:31:39
合計ジャッジ時間 6,531 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
41,560 KB
testcase_01 AC 137 ms
41,336 KB
testcase_02 AC 138 ms
41,428 KB
testcase_03 AC 121 ms
40,236 KB
testcase_04 AC 136 ms
41,504 KB
testcase_05 AC 157 ms
41,488 KB
testcase_06 AC 174 ms
41,652 KB
testcase_07 AC 170 ms
41,956 KB
testcase_08 AC 172 ms
41,508 KB
testcase_09 AC 166 ms
41,692 KB
testcase_10 AC 140 ms
41,380 KB
testcase_11 AC 139 ms
41,432 KB
testcase_12 AC 176 ms
41,952 KB
権限があれば一括ダウンロードができます

ソースコード

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