Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- price = input()
- a=price.split()
- p = list()
- print(a)
- n = 0
- while n < len(a) :
- p.append(int(a[n]))
- n = n+1
- p.sort()
- print(p)
- coins = input()
- def khoj(list,coin):
- first = 0
- last = len(list)-1
- found = False
- while found is False:
- mid = int((first+last)//2)
- if coin >= list[len(list)-1] or coin < list[0] or list[mid] == coin or list[mid+1] > coin > list[mid]:
- found = True
- if list[mid] == coin or list[mid+1] > coin > list[mid] :
- print(mid+1)
- elif coin >= list[len(list)-1] :
- print(len(list))
- elif coin < list[0] :
- print('0')
- else :
- if coin > list[mid] :
- first = mid+1
- else :
- last = mid-1
- khoj(p,int(coins))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement