Skip to content

Instantly share code, notes, and snippets.

@chuck0523

chuck0523/024_b.rb

Created Jan 3, 2016
Embed
What would you like to do?
n, t = gets.chomp.split.map(&:to_i)
now = 0
close = 0
sum = 0
n.times do |i|
now = gets.to_i
sum += t
if close - now > 0
sum -= close - now
end
close = now + t
end
puts sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment