結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-31 23:00:52 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 470 bytes |
| コンパイル時間 | 1,274 ms |
| コンパイル使用メモリ | 158,472 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 01:59:15 |
| 合計ジャッジ時間 | 1,855 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
#ifdef DEBUG
std::ifstream in("/home/share/inputf.in");
std::cin.rdbuf(in.rdbuf());
#endif
int ans = 0;
int n;
char c;
cin >> ans;
while(true) {
cin >> c;
if(cin.fail()) break;
cin >> n;
if(c == '*') {
ans += n;
} else {
// c == '+'
ans *= n;
}
}
cout << ans << endl;
return 0;
}