結果

問題 No.1694 ZerOne
コンテスト
ユーザー raven7959
提出日時 2021-10-07 07:33:23
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
TLE  
実行時間 -
コード長 312 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 363 ms
コンパイル使用メモリ 84,960 KB
実行使用メモリ 89,172 KB
最終ジャッジ日時 2026-04-03 12:20:00
合計ジャッジ時間 4,158 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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
if popcount*(popcount+1)//2>digitsum:
  print(0)
else:
  ans=0
  for num in combinations(range(1,len(S)+1),popcount):
    if sum(num)==digitsum:
      ans+=1
  print(ans)
0