Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Last active January 19, 2019 09:33
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/2f87b720285e4b9b313ac1a8a512319e to your computer and use it in GitHub Desktop.
Save whatalnk/2f87b720285e4b9b313ac1a8a512319e to your computer and use it in GitHub Desktop.
AtCoder AGC #030 A
# https://atcoder.jp/contests/agc030/submissions/4044101
a, b, c = gets.chomp.split(" ").map(&:to_i)
ans = 0
if c >= a
ans += a
c -= a
if c >= b
ans += b * 2
c -= b
if c > 0
ans += 1
end
else
ans += c
ans += b
end
else
ans += c
c = 0
ans += b
end
puts ans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment