結果
| 問題 | 
                            No.49 算数の宿題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-11-15 23:15:07 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 688 bytes | 
| コンパイル時間 | 663 ms | 
| コンパイル使用メモリ | 83,732 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-23 01:54:33 | 
| 合計ジャッジ時間 | 1,166 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 WA * 4 | 
ソースコード
#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;
}