Lang:Python2
Edit12345678910111213141516171819import heapqn, m, k = map(int, raw_input().split())a = map(int, raw_input().split())index = 0b = []while index + 1 < len(a):if a[index] < a[index + 1]:b.append([0, a[index + 1] - a[index], 1.0])b[-1][0] = b[-1][2] / b[-1][1]index += 1heapq.heapify(b)while k and b:top = heapq.heappop(b)top[2] += 1top[0] = top[2] / top[1]heapq.heappush(b, top)k -= 1res = heapq.heappop(b) if b else [0, 0, 1]print "{:.1f}".format(res[1] / res[2])