結果

問題 No.49 算数の宿題
ユーザー pluto77
提出日時 2016-02-17 11:30:16
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-23 01:48:43
合計ジャッジ時間 813 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#coding: utf-8
#yuki_49

s=raw_input()
ls=list(s)
s2=[]

i=0
while i<len(s):
 if ls[i]=='+':
  s2.insert(0,'(')
  s2.append(')')
  s2.append('*')
  s2.append(ls[i+1])
  i+=2
 elif s[i]=='*':
  s2.insert(0,'(')
  s2.append(')')
  s2.append('+')
  s2.append(ls[i+1])
  i+=2
 else:
  s2.append(ls[i])
  i+=1

exp="".join(s2)
print eval(exp)
0