結果
問題 | No.49 算数の宿題 |
ユーザー |
![]() |
提出日時 | 2016-02-28 12:22:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 350 bytes |
コンパイル時間 | 1,509 ms |
コンパイル使用メモリ | 159,120 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 01:48:51 |
合計ジャッジ時間 | 2,207 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { string s; cin >> s; ll sum = atoi(s.c_str()); ll index = log10(sum) + 1; while (index<s.size()) { ll x = atoi(s.c_str() + index + 1); sum = (s[index] == '*' ? sum + x : sum * x); index += 1 + (x == 0 ? 1 : log10(x)) + 1; } cout << sum << endl; return 0; }