You and your best friend Stripes have just landed your first high school jobs! You'll be delivering newspapers to your neighbourhood on weekends. For your services you'll be charging a set price depending on the quantity of the newspaper bundles.

The cost of deliveries is:

- $3.85 for 40 newspapers
- $1.93 for 20
- $0.97 for 10 
- $0.49 for 5 
- $0.10 for 1 

Stripes is taking care of the footwork doing door-to-door drops and your job is to take care of the finances. What you'll be doing is providing the cheapest possible quotes for your services.

Write a function that's passed an integer representing the amount of newspapers and returns the cheapest price. The returned number must be rounded to two decimal places.

![Paperboy](http://mametesters.org/file_download.php?file_id=1016&type=bug)

Difficulty: EASY
Starter code: def cheapest_quote(n):
	

Solutions:
def cheapest_quote(n):
	prices = [(40, 3.85), (20, 1.93), (10, 0.97), (5, 0.49), (1, 0.1)]
	result = 0
	for (q, c) in prices:
		result += n // q * c
		n = n % q
	return round(result, 2)


def f(n, v):
	return n / v - n % v / v

def cheapest_quote(n):
	return round(n * 0.1 - (f(n, 5) + f(n, 10) + f(n, 20) + f(n, 40)) * 0.01, 2)


DELIVERY_COST = ((40, 385), (20, 193), (10, 97), (5, 49), (1, 10))

def cheapest_quote(n):
	result = 0
	for (total_newspapers, cost_of_newspapers) in DELIVERY_COST:
		(q, r) = divmod(n, total_newspapers)
		if q:
			n -= q * total_newspapers
			result += q * cost_of_newspapers
		if not r:
			break
	return result / 100.0


def cheapest_quote(papers):
	prices = {40: 3.85, 20: 1.93, 10: 0.97, 5: 0.49, 1: 0.1}
	cost = 0
	for price in prices:
		cost += papers // price * prices[price]
		papers %= price
	return round(cost, 2)


d = {40: 3.85, 20: 1.93, 10: 0.97, 5: 0.49, 1: 0.1}

def cheapest_quote(n):
	(papers, total) = (40, 0)
	while n > 0:
		if n >= papers:
			total += d[papers] * (n // papers)
			n %= papers
		if papers > 5:
			papers //= 2
		else:
			papers = 1
	return round(total, 2)


def cheapest_quote(n):
	rates = [(40, 3.85), (20, 1.93), (10, 0.97), (5, 0.49), (1, 0.1)]
	total = 0
	for (bundle, price) in rates:
		total += n // bundle * price
		n %= bundle
	return round(total, 2)


costs = [(3.85, 40), (1.93, 20), (0.97, 10), (0.49, 5), (0.1, 1)]

def cheapest_quote(n):
	price = 0
	for (cost, qty) in costs:
		(q, n) = divmod(n, qty)
		price += cost * q
	return round(price, 2)


def cheapest_quote(n):
	(price, costs) = (0, [(1, 0.1), (5, 0.49), (10, 0.97), (20, 1.93), (40, 3.85)])
	while n:
		(quantity, cost) = costs.pop()
		price += n // quantity * cost
		n %= quantity
	return round(price, 2)


bundles = {40: 3.85, 20: 1.93, 10: 0.97, 5: 0.49, 1: 0.1}

def cheapest_quote(n):
	if n == 0:
		return 0.0
	for i in [40, 20, 10, 5, 1]:
		if n - i > -1:
			return round(int(n / i) * bundles[i] + cheapest_quote(n % i), 2)


def cheapest_quote(n):
	if n < 1:
		return 0
	bundles = iter([(40, 3.85), (20, 1.93), (10, 0.97), (5, 0.49), (1, 0.1)])
	total = 0
	while n > 0:
		(size, price) = next(bundles)
		if size <= n:
			(q, n) = divmod(n, size)
			total += q * price
	return round(total, 2)


d = __import__('collections').OrderedDict([(int(y), float(x)) for (x, y) in __import__('re').findall('(\\d\\.\\d{2}).*?(\\d+)', '\n        $3.85 for 40 newspapers\n        $1.93 for 20\n        $0.97 for 10\n        $0.49 for 5\n        $0.10 for 1\n        ')])

def cheapest_quote(n, r=0):
	for (k, v) in d.items():
		r += n // k * v
		n %= k
		if not n:
			break
	return round(r, 2)


b = {40: 3.85, 20: 1.93, 5: 0.49, 1: 0.1, 10: 0.97}

def cheapest_quote(n):
	a = [0.0]
	while n != 0:
		if n - 40 >= 0:
			n -= 40
			a.append(b[40])
			continue
		if n - 20 >= 0:
			n -= 20
			a.append(b[20])
			continue
		if n - 10 >= 0:
			n -= 10
			a.append(b[10])
			continue
		if n - 5 >= 0:
			n -= 5
			a.append(b[5])
			continue
		if n - 1 >= 0:
			n -= 1
			a.append(b[1])
			continue
		if n < 0:
			break
	return round(sum(a), 2)


def cheapest_quote(n):
	s1 = n // 40
	y1 = n % 40
	s2 = y1 // 20
	y2 = y1 % 20
	s3 = y2 // 10
	y3 = y2 % 10
	s4 = y3 // 5
	y4 = y3 % 5
	return float('%.2f' % (s1 * 3.85 + s2 * 1.93 + s3 * 0.97 + s4 * 0.49 + y4 * 0.1))


def cheapest_quote(n):
	forty = int(n / 40)
	twenty = int((n - forty * 40) / 20)
	ten = int((n - forty * 40 - twenty * 20) / 10)
	five = int((n - forty * 40 - twenty * 20 - ten * 10) / 5)
	one = int((n - forty * 40 - twenty * 20 - ten * 10 - five * 5) / 1)
	return round(forty * 3.85 + twenty * 1.93 + ten * 0.97 + five * 0.49 + one * 0.1, 2)