結果
問題 | No.1286 Stone Skipping |
ユーザー |
|
提出日時 | 2021-03-03 21:15:12 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 579 bytes |
コンパイル時間 | 152 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-10-03 10:56:02 |
合計ジャッジ時間 | 3,184 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 2 WA * 24 |
コンパイルメッセージ
Syntax OK
ソースコード
#うまい人の解答見た d = gets.chomp.to_i # jump = 100 # ans = 10 ** 19 def f(x,limt) len = 0 cnt = 0 while x > 0 && cnt < limt len += x x = x/ 2 cnt += 1 #x = x / 2 #jump_count += 1 end return len end ans = d 1.upto(100) do |i| left = 0 right = 10 ** 19 while (left - right) > 1 mid = (left + right) / 2 if d <= f(mid,i) right = mid else left = mid end end if f(right,i) == d && ans > right ans = right end end puts ans