Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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