結果
問題 |
No.222 引き算と足し算
|
ユーザー |
|
提出日時 | 2016-08-11 17:08:03 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 181 bytes |
コンパイル時間 | 298 ms |
コンパイル使用メモリ | 20,224 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-15 22:13:27 |
合計ジャッジ時間 | 1,293 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:13: warning: format ‘%c’ expects argument of type ‘char *’, but argument 3 has type ‘char (*)[2]’ [-Wformat=] 5 | scanf("%d%c%d", &a,&c,&b); | ~^ ~~ | | | | char * char (*)[2] main.c:5:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d%c%d", &a,&c,&b); | ^~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main (void){ int a, b; char c[2]; scanf("%d%c%d", &a,&c,&b); if(c[0] == '+'){ printf("%d", a-b); }else{ printf("%d", a+b); } return 0; }