結果

問題 No.688 E869120 and Constructing Array 2
ユーザー hang_hang_clnhang_hang_cln
提出日時 2018-06-09 10:07:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,996 KB
実行使用メモリ 8,112 KB
最終ジャッジ日時 2023-09-21 20:51:11
合計ジャッジ時間 1,216 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
7,892 KB
testcase_01 AC 17 ms
7,976 KB
testcase_02 AC 16 ms
7,920 KB
testcase_03 AC 15 ms
8,052 KB
testcase_04 AC 16 ms
7,976 KB
testcase_05 AC 15 ms
7,928 KB
testcase_06 AC 16 ms
7,920 KB
testcase_07 AC 16 ms
7,928 KB
testcase_08 AC 16 ms
7,948 KB
testcase_09 WA -
testcase_10 AC 16 ms
7,980 KB
testcase_11 AC 16 ms
7,988 KB
testcase_12 AC 15 ms
8,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

def cb(n,k):
    return int(math.factorial(n) / math.factorial(k) / math.factorial(n-k))
    
def sumCB(n): # nC0 ~ nCnまでの合計
    return 2**n

def main():
    K = int(input())
    for n in range(2,31):
        for i in range(2,n+1): # i:1の個数
            if K % cb(i,2) == 0:
                if cb(i,2) * sumCB(n-i) == K:
                    print(n)
                    b = '1' * i
                    b += '0' * (n-i)
                    print(' '.join(list(b)))
                    break
            else:
                continue

if __name__ == '__main__':
    main()
0