結果

問題 No.677 10^Nの約数
ユーザー Grenache
提出日時 2018-04-27 22:27:17
言語 Java
(openjdk 23)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 902 bytes
コンパイル時間 3,762 ms
コンパイル使用メモリ 77,012 KB
実行使用メモリ 54,292 KB
最終ジャッジ日時 2024-06-27 21:53:19
合計ジャッジ時間 7,314 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder677 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		NavigableSet<Long> ts = new TreeSet<>();
		ts.add(1L);

		for (int i = 0; i < n; i++) {
			NavigableSet<Long> tmp = new TreeSet<>(ts);

			for (long e : ts) {
				tmp.add(e * 2);
				tmp.add(e * 5);
				tmp.add(e * 10);
			}

			ts = tmp;
		}

		for (long e : ts) {
			pr.println(e);
		}
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(INPUT == null ? System.in : new ByteArrayInputStream(INPUT.getBytes()));
		pr = new Printer(System.out);

		solve();

//		pr.close();
		pr.flush();
//		sc.close();
	}

	static String INPUT = null;

	private static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}
0