結果
問題 |
No.49 算数の宿題
|
ユーザー |
|
提出日時 | 2016-02-06 19:23:59 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 311 bytes |
コンパイル時間 | 281 ms |
コンパイル使用メモリ | 19,712 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-23 01:48:17 |
合計ジャッジ時間 | 725 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 4 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:4:14: warning: implicit declaration of function ‘getchar’ [-Wimplicit-function-declaration] 4 | while((c=getchar())!=-1){ | ^~~~~~~ main.c:1:1: note: ‘getchar’ is defined in header ‘<stdio.h>’; did you forget to ‘#include <stdio.h>’? +++ |+#include <stdio.h> 1 | main.c:14:5: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration] 14 | printf("%d",!r?(m+s):(r<0?s:(m*s))); | ^~~~~~ main.c:14:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’ main.c:14:5: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch] main.c:14:5: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
ソースコード
int main(){ int s=0,i=1,r=-1,m=-1,c; while((c=getchar())!=-1){ if ('0'<=c){ s+=(c-'0')*i; i*=10; }else{ m=!r?(m+s):(r<0?s:(m*s)); r=c=='+'; i=1;s=0; } } printf("%d",!r?(m+s):(r<0?s:(m*s))); return 0; }