結果

問題 No.677 10^Nの約数
ユーザー ElkElk
提出日時 2018-07-21 18:40:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 637 bytes
コンパイル時間 1,552 ms
コンパイル使用メモリ 165,988 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 00:41:50
合計ジャッジ時間 6,441 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 9 ms
4,376 KB
testcase_11 AC 21 ms
4,376 KB
testcase_12 AC 75 ms
4,380 KB
testcase_13 AC 184 ms
4,380 KB
testcase_14 AC 583 ms
4,376 KB
testcase_15 AC 1,770 ms
4,384 KB
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    vector <long long int> num(pow(19, 2), 0);
    long long tmp, i, max, p = 1;
    int N, cnt, cnt2 = 0, cnt3 = 1;

    cin >> N;
    max = pow(10, N);
    tmp = max;
    cnt = pow(N + 1, 2) - 1;

    for(i = 1; i < max; i += p){
        if(tmp%i == 0){
            num[cnt2++] = i;
            if(i != tmp/i){
                num[cnt--] = tmp/i;
                max = tmp/i;
            }
        }
        if(i != 1 && i == pow(10, cnt3++)){
            p *= 5;
        }
    }

    for(i = 0; i < pow(N + 1, 2); i++){
        cout << num[i] << endl;
    }

    return 0;
}
0