結果

問題 No.688 E869120 and Constructing Array 2
ユーザー O2MTO2MT
提出日時 2020-12-15 20:45:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 85 ms / 1,000 ms
コード長 357 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 81,656 KB
実行使用メモリ 75,556 KB
最終ジャッジ日時 2023-10-20 06:32:29
合計ジャッジ時間 1,820 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,536 KB
testcase_01 AC 44 ms
59,264 KB
testcase_02 AC 60 ms
67,652 KB
testcase_03 AC 73 ms
73,356 KB
testcase_04 AC 66 ms
69,700 KB
testcase_05 AC 85 ms
75,556 KB
testcase_06 AC 81 ms
75,552 KB
testcase_07 AC 43 ms
59,264 KB
testcase_08 AC 68 ms
72,228 KB
testcase_09 AC 39 ms
53,536 KB
testcase_10 AC 47 ms
61,492 KB
testcase_11 AC 50 ms
61,492 KB
testcase_12 AC 54 ms
63,552 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