結果

問題 No.688 E869120 and Constructing Array 2
ユーザー nebukuro09nebukuro09
提出日時 2018-05-18 22:39:51
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 334 bytes
コンパイル時間 796 ms
コンパイル使用メモリ 6,688 KB
実行使用メモリ 6,136 KB
最終ジャッジ日時 2023-09-21 19:55:30
合計ジャッジ時間 1,016 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,064 KB
testcase_01 AC 11 ms
6,116 KB
testcase_02 AC 11 ms
6,052 KB
testcase_03 AC 11 ms
6,044 KB
testcase_04 AC 11 ms
6,012 KB
testcase_05 AC 12 ms
5,960 KB
testcase_06 AC 12 ms
6,132 KB
testcase_07 AC 11 ms
5,976 KB
testcase_08 AC 11 ms
6,104 KB
testcase_09 AC 11 ms
5,972 KB
testcase_10 AC 11 ms
6,064 KB
testcase_11 AC 11 ms
6,000 KB
testcase_12 AC 11 ms
6,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K = input()

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

A = [1, 1]
x = 2
S = set()
for i in xrange(60):
    S.add(2**i)

while True:
    y = x * (x - 1) / 2
    if K % y == 0 and K / y in S:
        K /= y
        break
    A.append(1)
    x += 1

while K > 1:
    A.append(0)
    K /= 2

print len(A)
print ' '.join(map(str, A))
0