結果
| 問題 |
No.688 E869120 and Constructing Array 2
|
| コンテスト | |
| ユーザー |
htkb
|
| 提出日時 | 2018-05-19 11:20:22 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 1,000 ms |
| コード長 | 494 bytes |
| コンパイル時間 | 100 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-07 13:59:34 |
| 合計ジャッジ時間 | 1,110 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 |
ソースコード
from math import factorial
K = int(input())
result = [0] if K == 0 else [1, 1] if K == 1 else []
if not result:
for i in range(2, 31):
comb = factorial(i)//2//factorial(i-2)
bin_k, bin_i = bin(K)[2:], bin(comb)[2:]
if bin_k.startswith(bin_i):
substr = bin_k[len(bin_i):]
if "1" not in substr and i + len(substr) <= 30:
result = [1]*i + [0]*len(substr)
break
print(len(result))
print(" ".join(map(str, result)))
htkb