結果

問題 No.688 E869120 and Constructing Array 2
ユーザー hang_hang_clnhang_hang_cln
提出日時 2018-06-09 09:56:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 733 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 76,376 KB
最終ジャッジ日時 2023-09-21 20:50:57
合計ジャッジ時間 8,065 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 231 ms
45,540 KB
testcase_02 AC 233 ms
45,584 KB
testcase_03 AC 243 ms
45,588 KB
testcase_04 AC 233 ms
45,436 KB
testcase_05 AC 230 ms
45,628 KB
testcase_06 AC 243 ms
45,620 KB
testcase_07 AC 241 ms
45,580 KB
testcase_08 AC 250 ms
45,512 KB
testcase_09 WA -
testcase_10 AC 229 ms
45,652 KB
testcase_11 AC 235 ms
45,512 KB
testcase_12 AC 238 ms
76,376 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

def test():
    n = 5
    i = 3
    b = '1' * i
    b += '0' * (n-i)
    print(' '.join(list(b)))

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