Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Last active January 26, 2016 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/e37c30cfdb2abe222e0c to your computer and use it in GitHub Desktop.
Save whatalnk/e37c30cfdb2abe222e0c to your computer and use it in GitHub Desktop.
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