結果

問題 No.688 E869120 and Constructing Array 2
コンテスト
ユーザー htkb
提出日時 2018-05-19 11:20:22
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 92 ms / 1,000 ms
コード長 494 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 968 ms
コンパイル使用メモリ 20,572 KB
実行使用メモリ 15,356 KB
最終ジャッジ日時 2026-03-29 04:39:42
合計ジャッジ時間 2,551 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from math import factorial
K = int(input())
result = [0] if K == 0 else [1, 1] if K == 1 else []
if not result:
    for i in range(2, 31):
        comb = factorial(i)//2//factorial(i-2)
        bin_k, bin_i = bin(K)[2:], bin(comb)[2:]
        if bin_k.startswith(bin_i):
            substr = bin_k[len(bin_i):]
            if "1" not in substr and i + len(substr) <= 30:
                result = [1]*i + [0]*len(substr)
                break
print(len(result))
print(" ".join(map(str, result)))
0