結果
問題 | No.193 筒の数式 |
ユーザー |
![]() |
提出日時 | 2015-08-19 21:01:49 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 10 ms / 1,000 ms |
コード長 | 457 bytes |
コンパイル時間 | 72 ms |
コンパイル使用メモリ | 6,944 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-18 10:34:37 |
合計ジャッジ時間 | 909 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
from re import findall def calc(s): ts = findall('\+|\-|\d+', s) if ts[0] == '+' or ts[0] == '-': return None acc = int(ts[0]) ts = ts[1:] while ts: if len(ts) == 1: return None if ts[0] == '+': acc += int(ts[1]) else: acc -= int(ts[1]) ts = ts[2:] return acc S = raw_input() ss = [(S+S)[i:i+len(S)] for i in range(len(S))] print(max(calc(s) for s in ss))