結果
| 問題 | No.222 引き算と足し算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-11 17:08:03 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 181 bytes |
| 記録 | |
| コンパイル時間 | 109 ms |
| コンパイル使用メモリ | 28,484 KB |
| 最終ジャッジ日時 | 2026-02-23 22:15:01 |
|
ジャッジサーバーID (参考情報) |
judge3 / 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;
}