結果
問題 |
No.677 10^Nの約数
|
ユーザー |
![]() |
提出日時 | 2020-09-03 20:22:22 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 135 ms / 2,000 ms |
コード長 | 643 bytes |
コンパイル時間 | 2,259 ms |
コンパイル使用メモリ | 86,356 KB |
実行使用メモリ | 41,872 KB |
最終ジャッジ日時 | 2024-11-24 00:32:26 |
合計ジャッジ時間 | 5,495 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); TreeSet<Long> ans = new TreeSet<>(); for (int i = 0; i <= n; i++) { long value = pow(2, i); for (int j = 0; j <= n; j++) { ans.add(value * pow(5, j)); } } StringBuilder sb = new StringBuilder(); for (long x : ans) { sb.append(x).append("\n"); } System.out.print(sb); } static long pow(long x, long y) { if (y == 0) { return 1; } else { return x * pow(x, y - 1); } } }