Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def s_c():
- n, k, x = tuple([int(x) for x in input().split()])
- a = [int(x) for x in input().split()]
- a.sort()
- j = 0
- count = k
- d = []
- for i in range(1,n):
- c = a[i]- a[i-1]
- if(c > x):
- d.append((j,c // x))
- j += 1
- d.sort(key= lambda item: item[1])
- print(j+1)
- i = 0
- while count > 0 and j != 0 and i < len(d):
- if(count >= d[i][1]):
- count -= d[i][1]
- j -= 1
- else:
- break
- i += 1
- print(j + 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement