結果

問題 No.193 筒の数式
ユーザー あかりきあかりき
提出日時 2021-03-13 20:25:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 43 ms / 1,000 ms
コード長 450 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,620 KB
実行使用メモリ 54,080 KB
最終ジャッジ日時 2024-04-23 10:36:09
合計ジャッジ時間 1,786 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
52,444 KB
testcase_01 AC 38 ms
52,564 KB
testcase_02 AC 39 ms
52,616 KB
testcase_03 AC 38 ms
52,004 KB
testcase_04 AC 39 ms
53,652 KB
testcase_05 AC 38 ms
52,856 KB
testcase_06 AC 37 ms
54,080 KB
testcase_07 AC 37 ms
52,756 KB
testcase_08 AC 36 ms
52,612 KB
testcase_09 AC 43 ms
52,812 KB
testcase_10 AC 37 ms
52,464 KB
testcase_11 AC 38 ms
52,708 KB
testcase_12 AC 38 ms
53,136 KB
testcase_13 AC 37 ms
52,964 KB
testcase_14 AC 38 ms
52,592 KB
testcase_15 AC 39 ms
52,900 KB
testcase_16 AC 38 ms
52,540 KB
testcase_17 AC 38 ms
52,476 KB
testcase_18 AC 38 ms
52,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

s=list(input())
ans=[]
for i in range(len(s)):
  x=s[i:]+s[:i]
  if x[0]!='+' and x[0]!='-' and x[-1]!='+' and x[-1]!='-':
    ct=0
    L=[]
    for j in range(len(x)-1,-1,-1):
      if x[j]=='+':
        L.reverse()
        ct+=int(''.join(L))
        L=[]
      elif x[j]=='-':
        L.reverse()
        ct-=int(''.join(L))
        L=[]
      else:
        L.append(x[j])
    L.reverse()
    ct+=int(''.join(L))
    ans.append(ct)
print(max(ans))
0