結果

問題 No.688 E869120 and Constructing Array 2
ユーザー O2MTO2MT
提出日時 2020-12-15 20:45:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 73 ms / 1,000 ms
コード長 357 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,744 KB
実行使用メモリ 76,368 KB
最終ジャッジ日時 2024-09-20 02:08:42
合計ジャッジ時間 1,560 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,352 KB
testcase_01 AC 42 ms
58,496 KB
testcase_02 AC 55 ms
67,072 KB
testcase_03 AC 64 ms
73,596 KB
testcase_04 AC 56 ms
68,608 KB
testcase_05 AC 73 ms
76,156 KB
testcase_06 AC 70 ms
76,368 KB
testcase_07 AC 44 ms
58,624 KB
testcase_08 AC 62 ms
71,552 KB
testcase_09 AC 39 ms
52,224 KB
testcase_10 AC 42 ms
60,544 KB
testcase_11 AC 45 ms
61,568 KB
testcase_12 AC 46 ms
62,720 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

K = int(input())
if K == 0:
    print(1)
    print(0,0)
    exit()
for i in range(31):
    for j in range(2,31-i):
        if (2**i)*combinations_count(j,2) == K:
            print(i+j)
            print(*([0]*i+[1]*j))
            exit()
0