結果

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

ソースコード

diff #

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

if k == 1:
    print(1)
    print(1)
    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