October 13, 2021

#5-masala - javob

Beshinchi masalaga Python da yozilgan javob. Siz o'z javobingizni kommentariyada qoldirishingiz mumkin.

a = input("Enter the number: ")
a = a.split()
list2 = [100000, 50000, 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 10, 5, 2, 1]

n = int(a[0])
m = int(a[1])

if n<m:
	print(0)
else:
	remainder = n-m
	output=[]
	index=0
	while index<=14:
		if remainder>=list2[index]:
			output.append(list2[index])
			remainder=remainder-list2[index]
		else:
			index+=1

print(len(output))