結果

問題 No.1694 ZerOne
ユーザー raven7959raven7959
提出日時 2021-10-07 07:40:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 446 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 87,004 KB
実行使用メモリ 114,848 KB
最終ジャッジ日時 2023-09-30 09:00:25
合計ジャッジ時間 5,223 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,484 KB
testcase_01 AC 73 ms
71,232 KB
testcase_02 AC 74 ms
71,440 KB
testcase_03 AC 123 ms
91,064 KB
testcase_04 AC 80 ms
76,052 KB
testcase_05 AC 86 ms
76,260 KB
testcase_06 AC 75 ms
71,312 KB
testcase_07 AC 86 ms
76,324 KB
testcase_08 AC 86 ms
76,592 KB
testcase_09 AC 122 ms
91,436 KB
testcase_10 AC 85 ms
76,544 KB
testcase_11 AC 74 ms
71,032 KB
testcase_12 AC 75 ms
71,416 KB
testcase_13 AC 90 ms
76,412 KB
testcase_14 AC 123 ms
91,224 KB
testcase_15 AC 84 ms
76,280 KB
testcase_16 AC 84 ms
76,508 KB
testcase_17 AC 80 ms
76,008 KB
testcase_18 AC 75 ms
71,464 KB
testcase_19 AC 75 ms
71,312 KB
testcase_20 AC 82 ms
76,524 KB
testcase_21 AC 196 ms
114,848 KB
testcase_22 AC 86 ms
76,580 KB
testcase_23 AC 189 ms
114,364 KB
testcase_24 AC 137 ms
91,608 KB
testcase_25 AC 141 ms
91,384 KB
testcase_26 AC 86 ms
76,584 KB
testcase_27 AC 176 ms
114,432 KB
testcase_28 AC 122 ms
91,220 KB
testcase_29 AC 90 ms
76,556 KB
testcase_30 AC 122 ms
91,300 KB
testcase_31 AC 130 ms
91,324 KB
testcase_32 AC 133 ms
91,552 KB
testcase_33 AC 136 ms
91,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import combinations

S=input()
popcount=0
digitsum=0
for i in range(len(S)):
  if S[i]=="1":
    popcount+=1
    digitsum+=i+1
DP=[[[0]*(digitsum+1) for _ in range(len(S)+1)] for _ in range(len(S)+1)]
DP[0][0][0]=1
for i in range(len(S)):
  for j in range(i+1):
    for k in range(digitsum+1):
      DP[i+1][j][k]+=DP[i][j][k]
      if k+i+1<=digitsum:
        DP[i+1][j+1][k+i+1]+=DP[i][j][k]
print(DP[len(S)][popcount][digitsum])
0