結果

問題 No.420 mod2漸化式
ユーザー None
提出日時 2021-03-13 18:51:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 251 bytes
コンパイル時間 624 ms
コンパイル使用メモリ 82,268 KB
実行使用メモリ 427,376 KB
最終ジャッジ日時 2024-10-15 09:14:19
合計ジャッジ時間 3,302 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other TLE * 1 -- * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

def k_bits(n,k):
    """ subset with popcnt = k in (1<<n)-1"""
    comb=(1<<k)-1
    while comb<(1<<n):
        yield comb
        x=comb&-comb
        y=comb+x
        comb=((comb&~y)//x>>1)|y

x=int(input())
P=list(k_bits(31,x))
print(len(P),sum(P))
0