Skip to content

Instantly share code, notes, and snippets.

@whatalnk
Created October 12, 2015 15:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whatalnk/af256d073af011b42b86 to your computer and use it in GitHub Desktop.
Save whatalnk/af256d073af011b42b86 to your computer and use it in GitHub Desktop.
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
Copy link
Author

whatalnk commented Nov 5, 2015

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

@whatalnk
Copy link
Author

whatalnk commented Nov 5, 2015

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