結果
| 問題 | No.49 算数の宿題 |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 18:36:57 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 63 ms / 5,000 ms |
| コード長 | 564 bytes |
| 記録 | |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 96,240 KB |
| 実行使用メモリ | 79,232 KB |
| 最終ジャッジ日時 | 2026-07-07 07:08:15 |
| 合計ジャッジ時間 | 2,071 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
S = input().strip()
tokens = []
temp_num = ''
# Tokenize the input string
for c in S:
if c.isdigit():
temp_num += c
else:
tokens.append(int(temp_num))
temp_num = ''
tokens.append(c)
tokens.append(int(temp_num)) # Add the last number
current = tokens[0]
# Process each operator and number pair
for i in range(1, len(tokens), 2):
operator = tokens[i]
num = tokens[i + 1]
if operator == '*':
current += num
else: # operator is '+', which means multiplication
current *= num
print(current)
lam6er