Advertisement
arvind_iyer_2001

C Part

Jun 20th, 2021
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. n, k, x = tuple([int(x) for x in input().split()])
  2.     a = [int(x) for x in input().split()]
  3.     a.sort()
  4.     j = 0
  5.     count = 0
  6.     for i in range(1,n):
  7.         c = a[i]-a[i-1]
  8.         if(c > x):
  9.             if(c/2 <= x and k != count):
  10.                 count += 1
  11.             else:
  12.                 j += 1
  13.     print(j+1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement