結果

問題 No.688 E869120 and Constructing Array 2
ユーザー brthyyjpbrthyyjp
提出日時 2020-11-12 22:47:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 1,000 ms
コード長 439 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 71,488 KB
最終ジャッジ日時 2023-09-30 01:51:59
合計ジャッジ時間 2,266 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,136 KB
testcase_01 AC 70 ms
71,084 KB
testcase_02 AC 70 ms
71,448 KB
testcase_03 AC 73 ms
71,120 KB
testcase_04 AC 70 ms
71,284 KB
testcase_05 AC 71 ms
71,356 KB
testcase_06 AC 70 ms
71,328 KB
testcase_07 AC 69 ms
71,336 KB
testcase_08 AC 70 ms
71,228 KB
testcase_09 AC 70 ms
71,312 KB
testcase_10 AC 70 ms
71,380 KB
testcase_11 AC 71 ms
71,376 KB
testcase_12 AC 69 ms
71,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

k = int(input())
if k == 0:
    print(1)
    print(0)
    exit()

if k == 1:
    print(2)
    print(1, 1)
    exit()

if k == 2:
    print(3)
    print(1, 1, 0)
    exit()

import math
for i in range(2, 10**5):
    t = i*(i-1)
    if (2*k)%t != 0:
        continue
    p = (2*k)//t
    c = 0
    while p%2 == 0:
        c += 1
        p //= 2
    if p != 1:
        continue
    print(c+i)
    ans = [0]*c+[1]*i
    print(*ans)
    exit()
0