結果

問題 No.49 算数の宿題
ユーザー 大友崚世
提出日時 2024-11-30 11:40:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 315 bytes
コンパイル時間 1,660 ms
コンパイル使用メモリ 166,792 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-30 11:41:00
合計ジャッジ時間 2,488 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main() {
	string s;
	cin >> s;
	int num = s.at(0) - '0';
	for (int i = 2; i < s.size(); i += 2) {
		string formula = s.substr(i - 1,i);
		if (formula.at(0) == '+') num += formula.at(1) - '0';
		else num *= formula.at(1) - '0';
	}
	cout << num << endl;
}

//1*2+3*4*5
0