結果

問題 No.688 E869120 and Constructing Array 2
ユーザー kohei2019kohei2019
提出日時 2022-03-12 16:11:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 37 ms / 1,000 ms
コード長 412 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,804 KB
実行使用メモリ 53,560 KB
最終ジャッジ日時 2023-10-16 23:50:37
合計ジャッジ時間 1,623 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,560 KB
testcase_01 AC 35 ms
53,560 KB
testcase_02 AC 37 ms
53,560 KB
testcase_03 AC 36 ms
53,560 KB
testcase_04 AC 37 ms
53,560 KB
testcase_05 AC 36 ms
53,560 KB
testcase_06 AC 37 ms
53,560 KB
testcase_07 AC 36 ms
53,560 KB
testcase_08 AC 36 ms
53,560 KB
testcase_09 AC 36 ms
53,560 KB
testcase_10 AC 36 ms
53,560 KB
testcase_11 AC 36 ms
53,560 KB
testcase_12 AC 36 ms
53,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K = int(input())
if K == 0:
    print(1)
    print(0)
    exit()
for i in range(2,10**5+1):
    if K < (i*(i-1) // 2):
        break
    if K % (i*(i-1) // 2) == 0:
        c = K // (i*(i-1) // 2)
        if bin(c).count('1') == 1:
            n1 = i
            n0 = 0
            while c > 1:
                c //= 2
                n0 += 1
            break
ans = [1]*n1 + [0]*n0
print(len(ans))
print(*ans)

0