結果

問題 No.688 E869120 and Constructing Array 2
ユーザー kerotono
提出日時 2018-05-18 23:17:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 749 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-07 13:38:20
合計ジャッジ時間 1,668 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 4 RE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#!python
# -*- coding: utf-8 -*-


def main():
    bit_T = []

    i = 0
    while True:
        a = 2**i
        if not (a <= 100000000):
            break
        bit_T.append(a)
        i += 1

    K = int(input())
    if K > 10000:
        1/0

    if K == 0:
        print(1)
        print("0")
    elif K == 1:
        print(2)
        print("1 1")

    one_num = 2
    i = 1
    n = 1
    s = '1 1'
    while True:
        if n > K:
            break
        for _, b in enumerate(bit_T):
            if b * n == K:
                s += ' 0' * _
                print(len(s) // 2 + 1)
                print(s)
                return
        i += 1
        n += i
        one_num += 1
        s += ' 1'


if __name__ == '__main__':
    main()
0