結果

問題 No.677 10^Nの約数
ユーザー matsuyoshi30matsuyoshi30
提出日時 2018-09-27 09:31:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 736 bytes
コンパイル時間 2,341 ms
コンパイル使用メモリ 74,892 KB
実行使用メモリ 54,604 KB
最終ジャッジ日時 2024-04-20 09:03:05
合計ジャッジ時間 6,029 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
54,352 KB
testcase_01 AC 134 ms
54,404 KB
testcase_02 AC 132 ms
54,312 KB
testcase_03 AC 138 ms
54,128 KB
testcase_04 AC 138 ms
54,604 KB
testcase_05 AC 137 ms
54,100 KB
testcase_06 AC 142 ms
54,300 KB
testcase_07 AC 141 ms
54,084 KB
testcase_08 AC 142 ms
54,256 KB
testcase_09 AC 141 ms
54,480 KB
testcase_10 AC 143 ms
54,152 KB
testcase_11 AC 150 ms
54,016 KB
testcase_12 AC 151 ms
54,324 KB
testcase_13 AC 152 ms
54,440 KB
testcase_14 AC 151 ms
54,380 KB
testcase_15 AC 155 ms
54,164 KB
testcase_16 AC 151 ms
54,196 KB
testcase_17 AC 156 ms
54,336 KB
testcase_18 AC 152 ms
54,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        long n = in.nextLong();

        // TLE
        // long m = (long)Math.pow(10, n);
        // for(long i=1; i<=m; i++) {
        //     if(m % i == 0) System.out.println(i);
        // }

        int c = (int)Math.pow(n+1, 2);
        long[] ans = new long[c];

        int index = 0;
        for(int i=0; i<=n; i++) {
            long t1 = (long)Math.pow(2,i);
            for(int j=0; j<=n; j++) {
                long t2 = (long)Math.pow(5,j);
                ans[index++] = t1 * t2;
            }
        }

        Arrays.sort(ans);
        for(int i=0; i<c; i++) System.out.println(ans[i]);
    }
}
0