Skip to content

Instantly share code, notes, and snippets.

@ninoseki
Created June 4, 2012 13:02
Show Gist options
  • Save ninoseki/2868232 to your computer and use it in GitHub Desktop.
Save ninoseki/2868232 to your computer and use it in GitHub Desktop.
# codeforce#122(Div2.A)
n, k = gets.chomp.split(" ").map{|e| e.to_i}
0.upto(n) do |i|
if (i * 2 + 5 * (n - i)) >= k and (i * 2 + 3 * (n - i)) <= k
puts i
break
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment