結果
問題 |
No.677 10^Nの約数
|
ユーザー |
![]() |
提出日時 | 2018-04-30 04:53:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,037 bytes |
コンパイル時間 | 196 ms |
コンパイル使用メモリ | 32,128 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-06-27 23:47:11 |
合計ジャッジ時間 | 5,376 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 15 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++){ long unsigned int c = a%i; long unsigned 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); } }