結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
togatoga
|
| 提出日時 | 2015-09-06 08:19:17 |
| 言語 | PyPy2 (7.3.20) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 5,000 ms |
| + 273µs | |
| コード長 | 650 bytes |
| 記録 | |
| コンパイル時間 | 66 ms |
| コンパイル使用メモリ | 81,280 KB |
| 実行使用メモリ | 81,252 KB |
| 最終ジャッジ日時 | 2026-07-17 20:25:02 |
| 合計ジャッジ時間 | 1,762 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
S = raw_input()
res = 0
tmp = 0
plus = False
mult = False
for x in range(len(S)):
if (S[x] == '*'):
if (plus):
res += tmp
elif (mult):
res *= tmp
else:
res = tmp
plus = mult = False
plus = True
tmp = 0
elif (S[x] == '+'):
if (plus):
res += tmp
elif (mult):
res *= tmp
else:
res = tmp
plus = mult = False
mult = True
tmp = 0
else:
tmp = 10 * tmp + int(S[x])
if (plus):
res += tmp
elif (mult):
res *= tmp
else:
res = tmp
print res
togatoga