結果

問題 No.688 E869120 and Constructing Array 2
ユーザー hedwig100hedwig100
提出日時 2020-05-06 17:20:57
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 560 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 7,948 KB
最終ジャッジ日時 2023-09-11 04:46:09
合計ジャッジ時間 2,177 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,768 KB
testcase_01 AC 16 ms
7,820 KB
testcase_02 AC 16 ms
7,860 KB
testcase_03 AC 16 ms
7,772 KB
testcase_04 AC 16 ms
7,800 KB
testcase_05 AC 16 ms
7,768 KB
testcase_06 AC 16 ms
7,692 KB
testcase_07 AC 16 ms
7,776 KB
testcase_08 AC 16 ms
7,772 KB
testcase_09 AC 16 ms
7,752 KB
testcase_10 AC 16 ms
7,872 KB
testcase_11 AC 16 ms
7,912 KB
testcase_12 AC 16 ms
7,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(100000000)
input = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    K = int(input())

    factorial = [1]
    for i in range(1,35):
        factorial.append(factorial[-1]*i)
    
    nck = lambda n,k: factorial[n]//factorial[k]//factorial[n - k]
    
    N = 0
    one = 0
    for i in range(1,31):
        for j in range(i + 1):
            if nck(j,2)*pow(2,i - j) == K:
                N = i
                one = j
    print(N)
    print(*([0]*(N - one) + [1]*one))
if __name__ == '__main__':
    main()
0