結果
| 問題 | 
                            No.49 算数の宿題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             human_cipher
                         | 
                    
| 提出日時 | 2021-06-24 01:32:02 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 34 ms / 5,000 ms | 
| コード長 | 501 bytes | 
| コンパイル時間 | 334 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,752 KB | 
| 最終ジャッジ日時 | 2024-12-23 02:15:26 | 
| 合計ジャッジ時間 | 1,587 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
S = input()
Num,Cal = [0],[]
for i in range(len(S)):
    if S[i] == "*":
        Cal.append("+")
    elif S[i] == "+":
        Cal.append("*")
    else:
        if i == 0:
            Num[0] = int(S[i])
        else:
            if S[i-1] == "*" or S[i-1] == "+":
                Num.append(int(S[i]))
            else:
                Num[-1] = Num[-1] * 10 + int(S[i])
ans = Num[0]
for i in range(len(Cal)):
    if Cal[i] == "+":
        ans += Num[i+1]
    else:
        ans *= Num[i+1]
print(ans)
            
            
            
        
            
human_cipher