Create a gist now

Instantly share code, notes, and snippets.

Codeforces #325 Div2
# #325 Div2 A. Alena's Schedule
n = gets.chomp.to_i
a = gets.chomp.split(" ").map(&:to_i)
lesson = 0
rest = 0
a.each do |i|
if i == 1 then
if rest == 1 and lesson > 0 then
lesson += 1
end
rest = 0
lesson += 1
else
rest += 1
end
end
puts lesson
@whatalnk
Owner
whatalnk commented Nov 5, 2015
  • A
  • B
  • C
  • D
  • E
  • F
@whatalnk
Owner
whatalnk commented Nov 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment