Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
AtCoder ABC #030
a, b, c, d = gets.chomp.split(" ").map(&:to_f)
takahashi = b / a
aoki = d / c
if takahashi > aoki then
puts "TAKAHASHI"
elsif takahashi < aoki then
puts "AOKI"
else
puts "DRAW"
end
n, m = gets.chomp.split(" ").map(&:to_i)
longer = ((720r/(24*60)) * (n*60 + m)) % 360
shorter = (360r/60) * m
r = (longer - shorter).abs.to_f
puts [r, 360-r].min
n, m = gets.chomp.split(" ").map(&:to_i)
x, y = gets.chomp.split(" ").map(&:to_i)
a = gets.chomp.split(" ").map(&:to_i)
b = gets.chomp.split(" ").map(&:to_i)
tnow = 0
res = 0
while true
# A => B
tnext = a.bsearch {|v| v >= tnow}
break if tnext.nil?
tnow = tnext + x
# B => A
tnext = b.bsearch {|v| v >= tnow}
break if tnext.nil?
tnow = tnext + y
res += 1
end
puts res
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment