結果

問題 No.566 だいたい完全二分木
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2020-01-28 19:15:00
言語 Ruby
(3.2.2)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 199 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 11,424 KB
実行使用メモリ 15,272 KB
最終ジャッジ日時 2023-10-13 20:51:28
合計ジャッジ時間 1,892 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,228 KB
testcase_01 AC 84 ms
15,224 KB
testcase_02 AC 82 ms
15,008 KB
testcase_03 AC 83 ms
15,128 KB
testcase_04 AC 82 ms
15,272 KB
testcase_05 AC 84 ms
14,968 KB
testcase_06 AC 82 ms
15,172 KB
testcase_07 AC 82 ms
15,020 KB
testcase_08 AC 86 ms
15,264 KB
testcase_09 AC 84 ms
15,224 KB
testcase_10 AC 88 ms
15,084 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def dfs(l,r)
  if r == l
    []
  elsif r - l == 1
    l
  else
    mid = (r + l) / 2
    mid == l ? l : [mid, dfs(l, mid), dfs(mid + 1, r)]
  end
end
puts [1, dfs(2, 1 << gets.to_i)].flatten * ' '

0