Create a gist now

Instantly share code, notes, and snippets.

Embed
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

This comment has been minimized.

Show comment
Hide comment
@whatalnk

whatalnk Nov 5, 2015

  • A
  • B
  • C
  • D
  • E
  • F
Owner

whatalnk commented Nov 5, 2015

  • A
  • B
  • C
  • D
  • E
  • F
@whatalnk

This comment has been minimized.

Show comment
Hide comment
Owner

whatalnk commented Nov 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment