結果
| 問題 | 
                            No.222 引き算と足し算
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Kmcode1
                         | 
                    
| 提出日時 | 2015-06-05 22:31:13 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 708 bytes | 
| コンパイル時間 | 764 ms | 
| コンパイル使用メモリ | 90,568 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-15 21:22:01 | 
| 合計ジャッジ時間 | 1,739 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 31 | 
ソースコード
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cctype>
#include<cstdlib>
#include<algorithm>
#include<bitset>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<ctime>
#include<complex>
#include<functional>
#include<climits>
#include<cassert>
#include<iterator>
using namespace std;
string s;
int main(){
	cin >> s;
	stringstream ss;
	ss << s;
	long long int k;
	ss >> k;
	long long int kari = 0;
	char op;
	while (ss >> op){
		ss >> kari;
		if (op == '-'){
			k += kari;
		}
		else{
			k -= kari;
		}
	}
	printf("%lld\n", k);
	return 0;
}
            
            
            
        
            
Kmcode1