Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created March 19, 2017 08:51
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/a9c7a58c60a5051effbe3c500d7bcdc4 to your computer and use it in GitHub Desktop.
Save whatalnk/a9c7a58c60a5051effbe3c500d7bcdc4 to your computer and use it in GitHub Desktop.
AtCOder ABC #010 [Ruby]
s = gets.chomp
puts s + "pp"
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
res = 0
a.each do |i|
case i
when 2 then res += 1
when 4 then res += 1
when 5 then res += 2
when 6 then res += 3
when 8 then res += 1
end
end
puts res
txa, tya, txb, tyb, t, v = gets.chomp.split(" ").map(&:to_i)
n = gets.chomp.to_i
ret = "NO"
n.times do
x, y = gets.chomp.split(" ").map(&:to_i)
l1 = Math.sqrt((txa - x)**2 + (tya - y)**2)
l2 = Math.sqrt((x - txb)**2 + (y - tyb)**2)
if (t * v) >= (l1 + l2) then
ret = "YES"
end
end
puts ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment