結果
問題 | No.222 引き算と足し算 |
ユーザー |
|
提出日時 | 2015-06-05 22:35:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 280 bytes |
コンパイル時間 | 775 ms |
コンパイル使用メモリ | 59,704 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 21:22:49 |
合計ジャッジ時間 | 1,375 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | scanf("%d%c%d", &x, &op, &y); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <utility> #include <string> using namespace std; int main() { int x, y; char op; scanf("%d%c%d", &x, &op, &y); int ans = x + y * (op == '+' ? -1 : 1); cout << ans << endl; return 0; }