結果

問題 No.550 夏休みの思い出(1)
ユーザー char134217728char134217728
提出日時 2017-08-16 08:11:18
言語 Ruby
(3.3.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 492 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 11,580 KB
実行使用メモリ 15,348 KB
最終ジャッジ日時 2023-08-03 15:17:45
合計ジャッジ時間 6,372 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,344 KB
testcase_01 AC 78 ms
15,252 KB
testcase_02 AC 76 ms
15,268 KB
testcase_03 AC 78 ms
15,036 KB
testcase_04 AC 77 ms
15,080 KB
testcase_05 AC 77 ms
15,048 KB
testcase_06 AC 81 ms
15,088 KB
testcase_07 AC 76 ms
15,336 KB
testcase_08 AC 77 ms
15,260 KB
testcase_09 AC 76 ms
15,124 KB
testcase_10 AC 76 ms
15,084 KB
testcase_11 AC 75 ms
15,040 KB
testcase_12 AC 75 ms
15,280 KB
testcase_13 AC 75 ms
15,120 KB
testcase_14 AC 76 ms
15,124 KB
testcase_15 AC 76 ms
15,244 KB
testcase_16 AC 76 ms
15,084 KB
testcase_17 AC 76 ms
15,040 KB
testcase_18 AC 76 ms
15,036 KB
testcase_19 AC 76 ms
15,348 KB
testcase_20 AC 77 ms
15,120 KB
testcase_21 AC 76 ms
15,116 KB
testcase_22 AC 76 ms
15,248 KB
testcase_23 AC 76 ms
15,140 KB
testcase_24 AC 76 ms
15,044 KB
testcase_25 AC 76 ms
15,344 KB
testcase_26 AC 76 ms
15,144 KB
testcase_27 AC 76 ms
15,152 KB
testcase_28 AC 76 ms
15,280 KB
testcase_29 AC 77 ms
15,084 KB
testcase_30 AC 76 ms
15,032 KB
testcase_31 AC 76 ms
15,084 KB
testcase_32 AC 76 ms
15,148 KB
testcase_33 AC 76 ms
15,076 KB
testcase_34 AC 76 ms
15,124 KB
testcase_35 AC 77 ms
15,032 KB
testcase_36 AC 77 ms
15,040 KB
testcase_37 AC 76 ms
15,280 KB
testcase_38 AC 78 ms
15,344 KB
testcase_39 AC 77 ms
15,244 KB
testcase_40 AC 76 ms
15,124 KB
testcase_41 AC 77 ms
15,144 KB
testcase_42 AC 76 ms
15,036 KB
testcase_43 AC 76 ms
15,292 KB
testcase_44 AC 77 ms
15,044 KB
testcase_45 AC 77 ms
15,124 KB
testcase_46 AC 77 ms
15,348 KB
testcase_47 AC 77 ms
15,152 KB
testcase_48 AC 78 ms
15,328 KB
testcase_49 AC 78 ms
15,080 KB
testcase_50 AC 77 ms
15,168 KB
testcase_51 AC 77 ms
15,288 KB
testcase_52 AC 77 ms
15,136 KB
testcase_53 AC 85 ms
15,044 KB
testcase_54 AC 78 ms
15,088 KB
testcase_55 AC 78 ms
15,048 KB
testcase_56 AC 77 ms
15,328 KB
testcase_57 AC 77 ms
15,152 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

a, b, c = gets.split(" ").map &:to_i
d = Math.sqrt(4*a*a - 12*b)
e1 = (d - 2 * a) / 6
e2 = (-1 * d - 2 * a) / 6
inf = 10**9
ans = []
[[-1*inf, e2], [e2, e1], [e1, inf]].each_with_index do |ar, idx|
  l = ar[0].to_f.floor
  r = ar[1].to_f.ceil
  while(r-l > 1) do
    mid = (l + r) / 2
    f = ((mid + a) * mid + b) * mid + c
    f *= -1 if idx == 1
    case f <=> 0
    when 0
      ans << mid
      break;
    when -1
      l = mid
    else
      r = mid
    end
  end
end
puts ans.join(" ")
0