結果

問題 No.677 10^Nの約数
ユーザー YamaKasaYamaKasa
提出日時 2018-06-06 23:18:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 177 ms / 2,000 ms
コード長 714 bytes
コンパイル時間 1,978 ms
コンパイル使用メモリ 73,612 KB
実行使用メモリ 56,692 KB
最終ジャッジ日時 2023-09-12 22:55:38
合計ジャッジ時間 5,690 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,460 KB
testcase_01 AC 125 ms
55,824 KB
testcase_02 AC 125 ms
55,896 KB
testcase_03 AC 126 ms
56,020 KB
testcase_04 AC 125 ms
55,560 KB
testcase_05 AC 127 ms
54,440 KB
testcase_06 AC 130 ms
55,928 KB
testcase_07 AC 134 ms
56,060 KB
testcase_08 AC 135 ms
55,564 KB
testcase_09 AC 136 ms
55,708 KB
testcase_10 AC 139 ms
55,868 KB
testcase_11 AC 143 ms
55,668 KB
testcase_12 AC 147 ms
55,636 KB
testcase_13 AC 151 ms
56,028 KB
testcase_14 AC 149 ms
55,636 KB
testcase_15 AC 161 ms
55,828 KB
testcase_16 AC 167 ms
56,140 KB
testcase_17 AC 177 ms
56,692 KB
testcase_18 AC 168 ms
56,224 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		scan.close();
		Set<Long> set = new TreeSet<Long>();
		Set<Long> set2 = new TreeSet<Long>();
		Long []M = {1L, 2L, 5L, 10L};
		set.add(1L);
		set.add(2L);
		set.add(5L);
		set.add(10L);
		if(N == 0) {
			System.out.println(1);
			System.exit(0);
		}
		for(int i = 0; i < N - 1; i++) {
			for(Long t1 : set) {
				for(Long t2 : M) {
					long t3 = t1 * t2;
					set2.add(t3);
				}
			}
			for(Long k : set2) {
				set.add(k);
			}
			set2.clear();
		}
		for(long t : set) {
			System.out.println(t);
		}
	}
}
0