結果

問題 No.3062 A + B
ユーザー CleyLCleyL
提出日時 2020-04-01 22:15:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,591 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 94,832 KB
実行使用メモリ 4,388 KB
最終ジャッジ日時 2023-09-09 18:37:28
合計ジャッジ時間 2,169 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 RE -
testcase_06 AC 1 ms
4,384 KB
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

//author:luckYrat(twitter:@luckYrat_)

#include <iostream>

#include <cmath>
#include <algorithm>
#include <iomanip>

#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <bitset>

#include <cctype>
#include <utility>
#include <climits>


using namespace std;
using ll = long long;
using P = pair<ll,ll>;


const int mod = 1000000007;
const int inf = (1<<30)-1;
const ll linf = (1LL<<62LL)-1;
const double EPS = (1e-10);


#define anyfill(n,s) setw(n) << setfill(s)
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,n,q) for(int i = n; (q) > i; i++)
#define dep(i,q) for(int i = (q); 0 < i; i--)


#define pb push_back
#define fir first
#define scn second
#define ednl endl


#define YesNo(a) (a?"Yes":"No")
#define YESNO(a) (a?"YES":"NO")
#define yesno(a) (a?"yes":"no")

P ar4[4] = {{0,1},{0,-1},{1,0},{-1,0}};
P ar8[8] = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};

char mp[1000][1000];
struct z{
  int x,y,p;
};
__attribute__((constructor))
void initial() {
 cin.tie(0);
 ios::sync_with_stdio(false);
}
int main(){
  string a,b;cin>>a>>b;
  string c = a+b;
  string d = "";
  string e = "";
  bool f = false;
  bool z = false;
  for(int i = 0; c.size() > i; i++){
    if(c[i]=='+' || c[i]=='-'){
      f = true;
      if(c[i]=='+')z=true;
    }else{
      if(f){
        e.push_back(c[i]);
      }else{
        d.push_back(c[i]);
      }
    }
  }
  if(d.empty()){
    cout << stol(e) << endl;
  }else {
    cout << (long)stol(d)+stol(e)*(z?1:-1) << endl;
  }


}
0