結果

問題 No.688 E869120 and Constructing Array 2
ユーザー brthyyjp
提出日時 2020-11-12 22:45:20
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 453 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-07-22 19:48:46
合計ジャッジ時間 1,708 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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, int(math.sqrt(k))+1):
    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