Created
January 3, 2016 10:33
-
-
Save chuck0523/76734931ad36138113b0 to your computer and use it in GitHub Desktop.
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
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