Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Codeforces #337 Div2
# [Problem - A - Codeforces](http://codeforces.com/contest/610/problem/A)
n = gets.chomp.to_i
if n.odd? then
puts 0
else
ab = n / 2
if ab.odd? then
puts (ab - 1) / 2
else
puts ab / 2 - 1
end
end
# [Problem - B - Codeforces](http://codeforces.com/contest/610/problem/B)
n = gets.chomp.to_i
jars = gets.chomp.split(" ").map(&:to_i)
jarmin = jars.min
if jars.uniq.length == 1 then
puts jars.length * jarmin
else
jars = jars * 2
rem = 0
i = 0
while true
break if jars.empty?
j = jars.shift
if j == jarmin then
rem = [rem, i].max
i = 0
else
i += 1
end
end
puts n * jarmin + [rem, i].max
end
@whatalnk

This comment has been minimized.

Copy link
Owner Author

commented Dec 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.