結果

問題 No.688 E869120 and Constructing Array 2
ユーザー prd_xxxprd_xxx
提出日時 2018-05-18 22:42:42
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 19 ms / 1,000 ms
コード長 238 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 8,412 KB
最終ジャッジ日時 2023-09-21 19:56:20
合計ジャッジ時間 1,307 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,268 KB
testcase_01 AC 19 ms
8,364 KB
testcase_02 AC 16 ms
8,312 KB
testcase_03 AC 16 ms
8,200 KB
testcase_04 AC 16 ms
8,412 KB
testcase_05 AC 16 ms
8,200 KB
testcase_06 AC 17 ms
8,308 KB
testcase_07 AC 17 ms
8,304 KB
testcase_08 AC 16 ms
8,264 KB
testcase_09 AC 16 ms
8,204 KB
testcase_10 AC 15 ms
8,208 KB
testcase_11 AC 16 ms
8,344 KB
testcase_12 AC 15 ms
8,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
K = int(input())

for i in range(31):
    d = K//(2**i)
    a = int(math.sqrt(d*2))
    if a*(a+1) == d*2:
        if i+a+1 > 30: continue
        print(i+a+1)
        arr = [0]*i + [1]*(a+1)
        print(*arr)
        exit()
0