Created
October 12, 2015 15:24
-
-
Save whatalnk/af256d073af011b42b86 to your computer and use it in GitHub Desktop.
Codeforces #325 Div2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# #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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment