You are viewing a single comment's thread. Return to all comments →
ruby:
gets.to_i.times do n,k = gets.strip.split.map &:to_i a = gets.strip.split.map &:to_i max, prev = (1..n).reduce(:+), 0 for i in 0...n do if a[i] > k max -= (1..prev).reduce(:+) || 0 prev = 0 else prev +=1 end i += 1 end max -= (1..prev).reduce(:+) || 0 puts max end
Seems like cookies are disabled on this browser, please enable them to open this website
Number List
You are viewing a single comment's thread. Return to all comments →
ruby: