Submission #8164679


Source Code Expand

Copy
def check(mid,a,b,x,border)
  if mid <= border 
    area = a*b - a*(a*Math.tan(mid/180.0*Math::PI))/2.0
  else
    area = b*(b*Math.tan((90.0-mid)/180.0*Math::PI))/2.0
  end
  #p [mid,a,b,x,border,area,x/a]
  return x/a < area
end

def bsearch(a,b,x)
  ok,ng = 0.0, 90.0
  border = 90.0 - Math.atan2(a,b)/(Math::PI)*180.0
  mid = 45.0
  5000.times do
    mid = (ok+ng)/2.0
    if check(mid,a,b,x,border)
      ok = mid
    else
      ng = mid
    end
  end
  return mid
end

a,b,x = gets.split.map(&:to_f)
p bsearch(a,b,x)

Submission Info

Submission Time
Task D - Water Bottle
User rinzu
Language Ruby (2.3.3)
Score 400
Code Size 548 Byte
Status AC
Exec Time 10 ms
Memory 1788 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample00, sample01, sample02
All handmade03, handmade04, random05, random06, random07, random08, random09, random10, random11, random12, random13, random14, sample00, sample01, sample02
Case Name Status Exec Time Memory
handmade03 AC 10 ms 1788 KB
handmade04 AC 9 ms 1788 KB
random05 AC 9 ms 1788 KB
random06 AC 9 ms 1788 KB
random07 AC 9 ms 1788 KB
random08 AC 9 ms 1788 KB
random09 AC 9 ms 1788 KB
random10 AC 9 ms 1788 KB
random11 AC 9 ms 1788 KB
random12 AC 9 ms 1788 KB
random13 AC 9 ms 1788 KB
random14 AC 9 ms 1788 KB
sample00 AC 9 ms 1788 KB
sample01 AC 9 ms 1788 KB
sample02 AC 9 ms 1788 KB