You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
323 B
13 lines
323 B
12 months ago
|
seconds = ARGF.read.strip.lines(chomp: true)
|
||
|
.sum {|line|
|
||
|
line.strip.split(/\s+/).fetch(4)
|
||
|
.split(?:).map(&:to_i)
|
||
|
.zip([60*60, 60, 1])
|
||
|
.sum { _1 * _2 }
|
||
|
}
|
||
|
|
||
|
hours, seconds = seconds.divmod(60 * 60)
|
||
|
minutes, seconds = seconds.divmod(60)
|
||
|
|
||
|
puts "#{hours} hours, #{minutes} minutes, #{seconds} seconds"
|