結果
問題 | No.222 引き算と足し算 |
ユーザー |
|
提出日時 | 2015-07-25 23:47:22 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 674 bytes |
コンパイル時間 | 764 ms |
コンパイル使用メモリ | 90,476 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 21:59:40 |
合計ジャッジ時間 | 1,774 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
#include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> using namespace std; int main() { string s; cin >> s; int i = 1; while(isdigit(s[i])) ++ i; int x = stoi(s.substr(0, i)); int y = stoi(s.substr(i+1)); int ans; if(s[i] == '+') ans = x - y; else ans = x + y; cout << ans << endl; return 0; }