結果
| 問題 | No.677 10^Nの約数 | 
| コンテスト | |
| ユーザー |  ike_nyan | 
| 提出日時 | 2018-04-30 04:52:45 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,009 bytes | 
| コンパイル時間 | 183 ms | 
| コンパイル使用メモリ | 32,128 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-06-27 23:47:06 | 
| 合計ジャッジ時間 | 5,408 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 8 WA * 7 TLE * 1 -- * 1 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:37:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   37 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
            
            ソースコード
#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;
        int c2 = a/i;
        if(c==0){
            if(c2!=i){
                push(c2);
            }
            printf("%d\n",i);
        }
    }
    long unsigned int tmp;
    
    while(pop(&tmp)){
        printf("%lu\n",tmp);
    }
   
}
            
            
            
        