結果
問題 |
No.437 cwwゲーム
|
ユーザー |
|
提出日時 | 2016-10-28 23:56:53 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 828 bytes |
コンパイル時間 | 115 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-11-24 06:43:36 |
合計ジャッジ時間 | 3,037 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 33 WA * 8 |
ソースコード
def solve(s): flag = [False] * len(s) ans = 0 def loop(i, score): nonlocal flag, ans if i >= len(s) - 2: ans = max(ans, score) return loop(i + 1, score) if s[i] == '0': return if flag[i]: return for j in range(i + 1, len(s) - 1): if flag[j]: continue flag[j] = True for k in range(j + 1, len(s)): if flag[k]: continue if s[j] != s[k]: continue flag[k] = True tmp = int(s[i] + s[j] + s[k]) loop(i + 1, score + tmp) flag[k] = False flag[j] = False loop(0, 0) return ans s = input() ans = solve(s) print(ans)