結果

問題 No.49 算数の宿題
ユーザー sggkshiosggkshio
提出日時 2016-11-15 23:15:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 688 bytes
コンパイル時間 711 ms
コンパイル使用メモリ 78,572 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-24 17:35:11
合計ジャッジ時間 1,138 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>



using namespace std;




int main() {
	string p;
	cin>>p;
	int y=0,x=0;
	vector<int>h;
	bool f=0;
	for(int i=0;i<p.size();i++){
		if(p[i]=='*'){
			x+=y;y=0;
			f=0;
		}
		else if(p[i]=='+'){
			if(x)y+=x;
			
			h.push_back(y);y=0;x=0;
			f=0;
		}
		else{
			y*=10;y+=p[i]-'0';
			f=1;
		}
	}
	if(x)y+=x;
	if(f)h.push_back(y);
	
	for(int i=1;i<h.size();i++){
		h[0]*=h[i];
	}
	cout<<h[0]<<endl;
	return 0;
}

	
0