Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created March 19, 2017 05:49
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/f84b99b69571847a440024e9e4c32599 to your computer and use it in GitHub Desktop.
Save whatalnk/f84b99b69571847a440024e9e4c32599 to your computer and use it in GitHub Desktop.
AtCoder ABC #056 [Ruby]
a, b = gets.chomp.split(" ")
if a == "H" then
if b == "H" then
ret = "H"
else
ret = "D"
end
else
if b == "H" then
ret = "D"
else
ret = "H"
end
end
puts ret
w, a, b = gets.chomp.split(" ").map(&:to_i)
if b + w < a then
ret = a - (b + w)
elsif a + w < b then
ret = b - (a + w)
else
ret = 0
end
puts ret
x = gets.chomp.to_i
sum = 0
i = 1
while true
if 2 * x <= (1 + i) * i then
puts i
exit
end
sum += i
i += 1
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment