結果
問題 |
No.222 引き算と足し算
|
ユーザー |
![]() |
提出日時 | 2015-11-17 21:24:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 919 bytes |
コンパイル時間 | 805 ms |
コンパイル使用メモリ | 100,316 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 22:07:11 |
合計ジャッジ時間 | 1,853 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:37:24: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 37 | char s[114514]; scanf("%s", s); | ~~~~~^~~~~~~~~
ソースコード
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <complex> #include <queue> #include <deque> #include <set> #include <map> #include <unordered_set> #include <unordered_map> #include <iomanip> #include <assert.h> #include <array> #include <cstdio> #include <cstring> #include <random> #include <functional> #include <numeric> #include <bitset> using namespace std; #define REP(i,a,b) for(int i=a;i<(int)b;i++) #define rep(i,n) REP(i,0,n) #define all(c) (c).begin(), (c).end() #define zero(a) memset(a, 0, sizeof a) #define minus(a) memset(a, -1, sizeof a) #define minimize(a, x) a = std::min(a, x) #define maximize(a, x) a = std::max(a, x) using ll = long long; int const inf = 1<<29; int main() { char s[114514]; scanf("%s", s); int x, y; char op; sscanf(s, "%d%c%d", &x, &op, &y); if(op=='-') { cout << x + y << endl; } else { cout << x - y << endl; } return 0; }