結果
問題 |
No.437 cwwゲーム
|
ユーザー |
|
提出日時 | 2020-08-06 09:23:23 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 135 ms / 2,000 ms |
コード長 | 572 bytes |
コンパイル時間 | 183 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 11,264 KB |
最終ジャッジ日時 | 2024-09-19 07:25:17 |
合計ジャッジ時間 | 3,197 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
from functools import lru_cache import itertools N = tuple(int(x) for x in list(input())) @lru_cache(maxsize=None) def rec(n): if len(n) < 2: return 0 res = 0 for selector in itertools.combinations(range(len(n)), 3): num = tuple(x for i, x in enumerate(n) if i in selector) cww = 0 if num[0] and num[0] != num[1] == num[2]: cww = num[0] * 100 + num[1] * 10 + num[2] remains = tuple(x for i, x in enumerate(n) if i not in selector) res = max(res, cww + rec(remains)) return res print(rec(N))