# AtCoder Grand Contest 003

URL: https://atcoder.jp/contests/agc003/ (opens new window)

# B

n = gets.chomp.to_i
arr = n.times.map{gets.chomp.to_i}

count = 0
prev_num = 0 # 0 or 1
arr.each do |a|
  count += (prev_num + a) / 2
  if a == 0
    prev_num = 0
  else
    prev_num = (prev_num + a) % 2
  end
end
puts count
Last Updated: 2020/08/31 15:27