結果
問題 | No.222 引き算と足し算 |
ユーザー |
![]() |
提出日時 | 2020-04-11 12:42:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 370 bytes |
コンパイル時間 | 1,693 ms |
コンパイル使用メモリ | 168,216 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-18 21:54:39 |
合計ジャッジ時間 | 2,977 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; signed main(){ string s;cin>>s; for(int i=1;i<s.size()-1;i++){ string u=s.substr(0,i); char c=s[i]; string v=s.substr(i+1,s.size()-i-1); if(c!='+'&&c!='-')continue; if(u.back()=='+'||u.back()=='-')continue; int a=stoi(u),b=stoi(v); if(c=='+')cout<<a-b<<endl; else cout<<a+b<<endl; } }