結果

問題 No.677 10^Nの約数
ユーザー ike_nyanike_nyan
提出日時 2018-04-30 04:51:06
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 1,036 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 34,156 KB
実行使用メモリ 7,624 KB
最終ジャッジ日時 2023-09-10 08:18:21
合計ジャッジ時間 5,552 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,560 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 12 ms
4,380 KB
testcase_13 AC 34 ms
4,376 KB
testcase_14 AC 104 ms
4,376 KB
testcase_15 AC 329 ms
4,376 KB
testcase_16 AC 1,030 ms
4,380 KB
testcase_17 TLE -
testcase_18 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

#define STACK_SIZE  1000
#define SUCCESS     1
#define FAILURE     0

typedef long unsigned int data_t;

data_t stack_data[STACK_SIZE];
int stack_num;

int push(data_t push_data)
{
    if (stack_num < STACK_SIZE) {
        stack_data[stack_num] = push_data;
        stack_num ++;
        return SUCCESS;
    } else {
        return FAILURE;
    }
}

int pop(data_t *pop_data)
{
    if (stack_num > 0) {
        stack_num --;
        *pop_data = stack_data[stack_num];
        return SUCCESS;
    } else {
        return FAILURE;
    }
}

int main(){
    int n = 0;
    scanf("%d",&n);
   
    long unsigned int a = pow(10, n);
    long double b = sqrt(a);

    stack_num = 0;

    for(int i=1; i<=b; i++){
        int c = a%i;
        if(c==0){
            if((a/i)!=i){
                // printf("%lu, %lu", c, i);
                push(a/i);
            }
            printf("%d\n",i);
        }
    }

    long unsigned int tmp;
    
    while(pop(&tmp)){
        printf("%lu\n",tmp);
    }
   
}
0