結果
問題 |
No.219 巨大数の概算
|
ユーザー |
![]() |
提出日時 | 2015-09-19 07:20:05 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 458 bytes |
コンパイル時間 | 101 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 07:52:37 |
合計ジャッジ時間 | 8,326 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 51 |
コンパイルメッセージ
main.c:3:5: warning: conflicting types for built-in function ‘log10’; expected ‘double(double)’ [-Wbuiltin-declaration-mismatch] 3 | int log10(long n){ | ^~~~~ main.c:2:1: note: ‘log10’ is declared in header ‘<math.h>’ 1 | #include <stdio.h> +++ |+#include <math.h> 2 | main.c:9:8: warning: conflicting types for built-in function ‘pow10’; expected ‘double(double)’ [-Wbuiltin-declaration-mismatch] 9 | double pow10(int n){ | ^~~~~ main.c: In function ‘main’: main.c:19:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | scanf("%i", &N); | ^~~~~~~~~~~~~~~ main.c:21:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | scanf("%ld", &A); | ^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int log10(long n){ int result; for(result=0;n>=10;result++)n/=10; return result; } double pow10(int n){ double result = 1.0; for(;n--;)result *= 10; return result; } int main(void){ int I, N, X, Y, Z; double S; long A; scanf("%i", &N); for(I=0;I<N;I++){ scanf("%ld", &A); Z = log10(A); S = (double)A / pow10(Z); X = (int)S; Y = (int)(S*10)%10; printf("%d %d %d", X, Y, Z); } return 0; }