結果

問題 No.688 E869120 and Constructing Array 2
ユーザー ikdikd
提出日時 2018-05-18 22:42:43
言語 Ruby
(3.3.0)
結果
AC  
実行時間 87 ms / 1,000 ms
コード長 229 bytes
コンパイル時間 42 ms
コンパイル使用メモリ 11,448 KB
実行使用メモリ 15,356 KB
最終ジャッジ日時 2023-09-21 19:56:23
合計ジャッジ時間 2,046 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
15,156 KB
testcase_01 AC 83 ms
15,156 KB
testcase_02 AC 80 ms
15,276 KB
testcase_03 AC 79 ms
15,084 KB
testcase_04 AC 79 ms
15,356 KB
testcase_05 AC 80 ms
15,176 KB
testcase_06 AC 80 ms
15,132 KB
testcase_07 AC 79 ms
15,308 KB
testcase_08 AC 80 ms
15,176 KB
testcase_09 AC 79 ms
15,152 KB
testcase_10 AC 83 ms
15,328 KB
testcase_11 AC 82 ms
15,236 KB
testcase_12 AC 80 ms
15,036 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

k=gets.chomp.to_i

1.upto 30 do |n|
  0.upto 30 do |one|
    zero=n-one
    next if zero<0
    if (one)*(one-1)/2*(2**zero)==k
      arr=[1]*one+[0]*zero
      puts n
      puts arr.join(' ')
      exit 0
    end
  end
end

raise
0