結果
問題 |
No.8062 A + B
|
ユーザー |
|
提出日時 | 2020-04-01 23:30:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 517 bytes |
コンパイル時間 | 800 ms |
コンパイル使用メモリ | 85,500 KB |
最終ジャッジ日時 | 2025-01-09 12:26:24 |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 WA * 2 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <queue> #include <map> #include <set> #include <bitset> using namespace std; typedef long long ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); string s,t; cin >> s >> t; s+=t; ll ans=0; ll num=0; ll sign=1; for(char c:s){ if(c=='-'){ ans+=sign*num; num=0; sign=-1; } else if(c=='+'){ ans+=sign*num; num=0; sign=1; } else{ num*=10; num+=(c-'0'); } } ans+=sign*num; cout << ans << endl; }