結果
問題 | No.437 cwwゲーム |
ユーザー |
|
提出日時 | 2021-03-14 11:01:46 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 190 ms / 2,000 ms |
コード長 | 561 bytes |
コンパイル時間 | 163 ms |
コンパイル使用メモリ | 82,452 KB |
実行使用メモリ | 78,372 KB |
最終ジャッジ日時 | 2024-10-15 20:09:33 |
合計ジャッジ時間 | 4,626 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
N=input() pt=[] for i in range(len(N)): for j in range(i+1,len(N)): for k in range(j+1,len(N)): if all([N[i]!=N[j],N[j]==N[k],N[i]!="0"]): pt.append((i,j,k)) from copy import deepcopy def ans(his,nu): if his.count(0)<3: return nu maximum=nu for i,j,k in pt: if all([his[i]==0,his[j]==0,his[k]==0]): his_c=deepcopy(his) his_c[i]=1;his_c[j]=1;his_c[k]=1 maximum=max(maximum,ans(his_c,nu+int(N[i])*100+int(N[j])*11)) return maximum print(ans([0]*len(N),0))