結果
| 問題 |
No.49 算数の宿題
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 20:15:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 5,000 ms |
| コード長 | 564 bytes |
| コンパイル時間 | 211 ms |
| コンパイル使用メモリ | 82,644 KB |
| 実行使用メモリ | 53,936 KB |
| 最終ジャッジ日時 | 2025-03-20 20:16:29 |
| 合計ジャッジ時間 | 1,159 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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