結果

問題 No.688 E869120 and Constructing Array 2
ユーザー ThetaTheta
提出日時 2022-11-18 15:42:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 409 bytes
コンパイル時間 663 ms
コンパイル使用メモリ 11,700 KB
実行使用メモリ 9,936 KB
最終ジャッジ日時 2023-10-20 01:56:29
合計ジャッジ時間 1,321 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
9,936 KB
testcase_01 AC 32 ms
9,936 KB
testcase_02 AC 29 ms
9,936 KB
testcase_03 AC 29 ms
9,936 KB
testcase_04 AC 29 ms
9,936 KB
testcase_05 AC 29 ms
9,936 KB
testcase_06 AC 29 ms
9,936 KB
testcase_07 AC 29 ms
9,936 KB
testcase_08 AC 29 ms
9,936 KB
testcase_09 AC 28 ms
9,936 KB
testcase_10 AC 28 ms
9,936 KB
testcase_11 AC 29 ms
9,936 KB
testcase_12 AC 28 ms
9,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    K = int(input())

    if K == 0:
        print(1)
        print(0)
        return

    for length in range(2, 31):
        for len_1 in range(1, length+1):
            if ((len_1) * (len_1 - 1) // 2) * 2 ** (length - len_1) == K:
                print(length)
                print(" ".join(list("1"*len_1 + "0"*(length-len_1))))
                return


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