結果
| 問題 |
No.193 筒の数式
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-27 00:50:51 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 1,000 ms |
| コード長 | 839 bytes |
| コンパイル時間 | 85 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-05 03:21:54 |
| 合計ジャッジ時間 | 1,418 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
S = input()
maxnum = -9999999999999999999999999
length = len(S)
checknum = lambda x, line: not (line[x] == "+" or line[x] == "-")
for i in range(length):
line = S[i:length] + S[0:i]
tline = line
if not checknum(0, line) or not checknum(len(line) - 1, line):
continue
j = 0
while tline[j] == "0":
j += 1
if not checknum(j, tline):
tline = tline[j - 1:len(tline)]
j = 1
while j < len(tline):
if not checknum(j - 1, tline) and tline[j] == "0":
if j == len(tline) - 1:
break
else:
if checknum(j + 1, tline):
tline = tline[0:j] + tline[j+1:len(tline)]
else:
j += 1
line = tline
try:
maxnum = max(maxnum, eval(line))
except:
pass
print(maxnum)