結果

問題 No.688 E869120 and Constructing Array 2
ユーザー kobaya0514kobaya0514
提出日時 2018-05-18 23:09:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 314 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 10,724 KB
実行使用メモリ 7,964 KB
最終ジャッジ日時 2023-09-21 20:03:44
合計ジャッジ時間 1,166 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,788 KB
testcase_01 AC 15 ms
7,828 KB
testcase_02 AC 15 ms
7,884 KB
testcase_03 AC 15 ms
7,788 KB
testcase_04 AC 14 ms
7,872 KB
testcase_05 AC 14 ms
7,864 KB
testcase_06 AC 14 ms
7,836 KB
testcase_07 AC 14 ms
7,964 KB
testcase_08 AC 16 ms
7,880 KB
testcase_09 AC 14 ms
7,832 KB
testcase_10 AC 14 ms
7,836 KB
testcase_11 AC 15 ms
7,800 KB
testcase_12 AC 14 ms
7,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

K=int(input())
one=[0,0]
for i in range(2,31):
  one.append(i*(i-1)//2)
zero=[1]
for i in range(1,29):
  zero.append(2**i)

ans0=0
ans1=0

for i in range(len(one)):
  for j in range(len(zero)):
    if one[i]*zero[j]==K and i+j<31:
      ans0,ans1=j,i
      break

ans=[0]*ans0+[1]*ans1
print(len(ans))
print(*ans)
0