結果

問題 No.688 E869120 and Constructing Array 2
ユーザー daku9640daku9640
提出日時 2018-05-18 23:25:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 17 ms / 1,000 ms
コード長 381 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 8,092 KB
最終ジャッジ日時 2023-09-21 20:06:34
合計ジャッジ時間 1,226 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,956 KB
testcase_01 AC 16 ms
7,984 KB
testcase_02 AC 17 ms
7,956 KB
testcase_03 AC 17 ms
7,952 KB
testcase_04 AC 16 ms
7,900 KB
testcase_05 AC 17 ms
8,048 KB
testcase_06 AC 17 ms
8,044 KB
testcase_07 AC 17 ms
8,056 KB
testcase_08 AC 16 ms
7,920 KB
testcase_09 AC 16 ms
7,980 KB
testcase_10 AC 16 ms
7,948 KB
testcase_11 AC 17 ms
8,092 KB
testcase_12 AC 17 ms
8,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import factorial
c = lambda y, x: factorial(y) // factorial(x) // factorial(y - x)
def solve():
    k = int(input())
    if k == 0:
        print(1)
        return [0]
    for i in range(0, 31):
        for j in range(2, 31 - i):
            if (1 << i) * c(j, 2) == k:
                print(i + j)
                return [0] * i + [1] * j
    return [0]
print(*solve())
0