結果

問題 No.49 算数の宿題
ユーザー rocoderrocoder
提出日時 2017-06-26 05:10:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 18 ms / 5,000 ms
コード長 460 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 7,872 KB
最終ジャッジ日時 2023-08-24 17:37:37
合計ジャッジ時間 911 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,828 KB
testcase_01 AC 16 ms
7,784 KB
testcase_02 AC 17 ms
7,872 KB
testcase_03 AC 16 ms
7,832 KB
testcase_04 AC 18 ms
7,856 KB
testcase_05 AC 15 ms
7,824 KB
testcase_06 AC 15 ms
7,824 KB
testcase_07 AC 15 ms
7,780 KB
testcase_08 AC 16 ms
7,784 KB
testcase_09 AC 15 ms
7,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#49 homework arithmetic*+
S=list(input())
i=0
a=[]
j=0
b=[]
while i<len(S):
    a.append("")
    while i<len(S) and S[i]!="*" and S[i]!="+":
        a[j]+=S[i]
#        print (a)
        i+=1
    if i<len(S):
        b.append(S[i])
#    print (b)
    j+=1
    i+=1
#print(a)
for i in range(len(a)):
#    print (i)
    a[i]=int(a[i])
d=a[0]
#print (d)
for i in range(len(a)-1):
    x=a[i+1]
    y=b[i]
    if y=="*":
        d+=x
    else:
        d*=x
print(d)
0