結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 205 ms
45,560 KB
testcase_01 AC 196 ms
45,464 KB
testcase_02 AC 199 ms
45,316 KB
testcase_03 AC 211 ms
45,244 KB
testcase_04 AC 201 ms
45,508 KB
testcase_05 AC 231 ms
45,192 KB
testcase_06 AC 204 ms
45,192 KB
testcase_07 AC 204 ms
45,428 KB
testcase_08 AC 212 ms
45,340 KB
testcase_09 WA -
testcase_10 AC 207 ms
45,216 KB
testcase_11 AC 207 ms
45,548 KB
testcase_12 AC 206 ms
45,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from scipy.special import comb

def cb(n,k):
    return int(comb(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