結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,056 KB
testcase_01 AC 18 ms
8,096 KB
testcase_02 AC 19 ms
7,984 KB
testcase_03 AC 20 ms
7,968 KB
testcase_04 AC 18 ms
7,976 KB
testcase_05 WA -
testcase_06 AC 18 ms
7,980 KB
testcase_07 AC 19 ms
7,896 KB
testcase_08 AC 19 ms
7,924 KB
testcase_09 WA -
testcase_10 AC 17 ms
8,016 KB
testcase_11 AC 18 ms
7,948 KB
testcase_12 AC 19 ms
8,096 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までの合計
    ans = 0
    for i in range(0,n+1):
        ans += cb(n,i)
    
    return ans

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