結果

問題 No.897 compαctree
ユーザー simansiman
提出日時 2020-10-30 11:39:56
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 274 bytes
コンパイル時間 318 ms
コンパイル使用メモリ 11,344 KB
実行使用メモリ 37,008 KB
最終ジャッジ日時 2023-09-29 04:17:19
合計ジャッジ時間 3,631 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,080 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 82 ms
15,084 KB
testcase_12 AC 84 ms
15,108 KB
testcase_13 AC 85 ms
15,084 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

Q = gets.to_i
Q.times do
  n, k = gets.split.map(&:to_i)

  if k == 1
    puts n - 1
  else
    ok = 100
    ng = 0

    while (ok - ng).abs >= 2
      h = (ok + ng) / 2

      if n <= h ** k
        ok = h
      else
        ng = h
      end
    end

    puts ok
  end
end
0