結果

問題 No.688 E869120 and Constructing Array 2
コンテスト
ユーザー hang_hang_cln
提出日時 2018-06-09 09:56:53
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
TLE  
実行時間 -
コード長 634 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 353 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 69,860 KB
最終ジャッジ日時 2026-03-29 05:02:59
合計ジャッジ時間 9,703 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 3
other TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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