結果

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

ソースコード

diff #

seq = list(input())
seq = list(map(int,seq))
N = len(seq)
max_sum = 0

def calc(i,lst,sum_cww):
    global max_sum
    if i<0:
        if sum_cww>max_sum:
            max_sum=sum_cww
        return
    x = seq[i]
    lst[x]+=1
    calc(i-1,lst[:],sum_cww)
    if x==0:
        return
    for j in range(10):
        if lst[j]>1 and j!=x:
            tmp = lst[:]
            tmp[x] -= 1
            tmp[j] -= 2
            calc(i-1,tmp[:],sum_cww+x*100+j*11)

calc(N-1,[0]*10,0)
print(max_sum)
0