結果

問題 No.437 cwwゲーム
ユーザー hanorver
提出日時 2016-10-29 00:38:48
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 756 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-12 08:27:33
合計ジャッジ時間 4,788 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(s,u,c):
 m=c
 for i in range(len(s)):
  for j in range(i+1,len(s)):
   for k in range(j+1,len(s)):
    if s[i]!='0' and s[j]==s[k]and s[i]!=s[j]:
     if not(u[i]or u[j]or u[k]):
      u[i]=u[j]=u[k]=True;m=max(m,f(s,u,c+int(s[i]+s[j]+s[k])));u[i]=u[j]=u[k]=False
 return m
s=input()
u=[False]*len(s)
print(f(s,u,0))
0