結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-30 13:03:31 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.90.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 517 bytes |
| 記録 | |
| コンパイル時間 | 3,662 ms |
| コンパイル使用メモリ | 355,460 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-07-30 13:03:42 |
| 合計ジャッジ時間 | 3,627 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
int main()
{
str s;
cin >> s;
stringstream ss(s);
ll n;
char o;
vector<ll> st;
ss >> n;
st.push_back(n);
while (ss >> o >> n)
{
if (o == '*')
{
ll t = st.back();
st.pop_back();
st.push_back(t * n);
}
else if (o == '+') st.push_back(n);
}
ll ans = 0;
for (ll x : st) ans += x;
cout << ans;
return 0;
}