結果
問題 |
No.8062 A + B
|
ユーザー |
![]() |
提出日時 | 2020-04-01 22:10:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 444 bytes |
コンパイル時間 | 2,038 ms |
コンパイル使用メモリ | 193,088 KB |
最終ジャッジ日時 | 2025-01-09 12:04:50 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | WA * 8 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string a, b, formula; cin >> a >> b; formula = a + '+' + b; int ans = 0, cache = 0; for (char c : formula) { if (c == '+') { ans += cache; cache = 0; } else if (c == '-') { ans -= cache; cache = 0; } else { cache = 10 * cache + c - '0'; } } cout << ans << endl; }