結果

問題 No.1176 少ない質問
ユーザー simansiman
提出日時 2020-08-22 02:09:26
言語 Ruby
(3.3.0)
結果
AC  
実行時間 121 ms / 1,000 ms
コード長 271 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 13,184 KB
最終ジャッジ日時 2024-04-23 06:50:36
合計ジャッジ時間 3,388 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
13,056 KB
testcase_01 AC 113 ms
12,928 KB
testcase_02 AC 116 ms
12,928 KB
testcase_03 AC 114 ms
12,928 KB
testcase_04 AC 114 ms
12,928 KB
testcase_05 AC 115 ms
12,928 KB
testcase_06 AC 117 ms
13,056 KB
testcase_07 AC 116 ms
13,184 KB
testcase_08 AC 116 ms
13,056 KB
testcase_09 AC 117 ms
13,056 KB
testcase_10 AC 114 ms
13,056 KB
testcase_11 AC 115 ms
13,056 KB
testcase_12 AC 117 ms
12,928 KB
testcase_13 AC 113 ms
13,184 KB
testcase_14 AC 117 ms
12,928 KB
testcase_15 AC 117 ms
13,184 KB
testcase_16 AC 121 ms
12,928 KB
testcase_17 AC 118 ms
12,928 KB
testcase_18 AC 115 ms
12,928 KB
testcase_19 AC 115 ms
13,184 KB
testcase_20 AC 90 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

A = gets.to_i

def f(e)
  return A if e == 1

  ok = A
  ng = 0

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

    if A <= x ** e
      ok = x
    else
      ng = x
    end
  end

  ok
end

ans = A

2.upto(110) do |e|
  v = e * f(e)
  ans = v if ans > v
end

puts ans
0