結果
問題 | No.1286 Stone Skipping |
ユーザー | masashi0217 |
提出日時 | 2021-03-02 18:14:39 |
言語 | Ruby (3.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 843 bytes |
コンパイル時間 | 51 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-04-14 04:45:33 |
合計ジャッジ時間 | 3,924 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 87 ms
12,288 KB |
testcase_01 | AC | 82 ms
12,288 KB |
testcase_02 | AC | 83 ms
12,416 KB |
testcase_03 | AC | 92 ms
12,160 KB |
testcase_04 | AC | 85 ms
12,288 KB |
testcase_05 | WA | - |
testcase_06 | AC | 83 ms
12,160 KB |
testcase_07 | AC | 83 ms
12,288 KB |
testcase_08 | AC | 83 ms
12,160 KB |
testcase_09 | AC | 86 ms
12,160 KB |
testcase_10 | AC | 86 ms
12,288 KB |
testcase_11 | AC | 84 ms
12,160 KB |
testcase_12 | AC | 87 ms
12,160 KB |
testcase_13 | AC | 89 ms
12,160 KB |
testcase_14 | AC | 85 ms
12,160 KB |
testcase_15 | WA | - |
testcase_16 | AC | 84 ms
12,160 KB |
testcase_17 | AC | 85 ms
12,160 KB |
testcase_18 | AC | 85 ms
12,416 KB |
testcase_19 | AC | 87 ms
12,288 KB |
testcase_20 | AC | 86 ms
12,160 KB |
testcase_21 | AC | 83 ms
12,160 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | AC | 85 ms
12,160 KB |
testcase_26 | AC | 84 ms
12,160 KB |
testcase_27 | AC | 82 ms
12,288 KB |
testcase_28 | WA | - |
コンパイルメッセージ
Syntax OK
ソースコード
d = gets.chomp.to_i left = -1 right = 10 ** 18 min = 10 ** 18 while right - left > 1 mid = (left+right)/2 x = mid.dup if x < d ok = true dist = x #print "xは" + "#{x}" + " " + "dは" + "#{d}" + "\n" until mid == 0 mid = mid / 2 dist += mid if dist == d min = [min,x].min #ok = true elsif dist > d ok = false break end #p dist end elsif x == d min = [min,x].min ok = true else ok = false end if ok == false right = x else left = x end # puts "\\" # p min # p right # p left # p ok # print "xは" + "#{x}" + " " + "dは" + "#{d}" + "\n" # puts "----" end puts min