結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
hang_hang_cln
|
| 提出日時 | 2018-06-09 10:09:44 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 1,000 ms |
| コード長 | 702 bytes |
| コンパイル時間 | 77 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-07 14:15:01 |
| 合計ジャッジ時間 | 1,013 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
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())
if K == 0:
print(1)
print(1)
else:
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()
hang_hang_cln