You are given that a mango weighs X kilograms and a truck weighs Y kilograms.
You want to cross a bridge that can withstand a weight of Z kilograms. 

Find the maximum number of mangoes you can load in the truck so that you can cross the bridge safely.

------ Input Format ------ 

- First line will contain T, the number of test cases. Then the test cases follow.
- Each test case consists of a single line of input, three integers X, Y, Z - the weight of mango, the weight of truck and the weight the bridge can withstand respectively.

------ Output Format ------ 

For each test case, output in a single line the maximum number of mangoes that you can load in the truck.

------ Constraints ------ 

$1 ≤ T ≤ 1000$
$1 ≤ X ≤ Y ≤ Z ≤ 100$

----- Sample Input 1 ------ 
4
2 5 11
4 10 20
1 1 1
6 40 90

----- Sample Output 1 ------ 
3
2
0
8

----- explanation 1 ------ 
Test case $1$: You can load $3$ mangoes at maximum. The total weight is $ 3\times 2+5 = 11 ≤ 11$. Thus, the truck can safely cross the bridge with $3$ mangoes. If you load $4$ mangoes, the total weight is $4\times 2+5 = 13 > 11$. 

Test case $2$: You can load $2$ mangoes at maximum. The total weight is $ 2\times 4+10 = 18 ≤ 20$. Thus, the truck can safely cross the bridge with $2$ mangoes.

Test case $3$: You can load $0$ mangoes at maximum. The total weight is $ 0\times 1+1 = 1 ≤ 1$. Thus, the truck can safely cross the bridge only if there are $0$ mangoes.

Test case $4$: You can load $8$ mangoes at maximum. The total weight is $ 6\times 8+40 = 88 ≤ 90$. Thus, the truck can safely cross the bridge with $8$ mangoes.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	c = z - y
	print(c // x)


import math
t = int(input())
for t in range(t):
	(x, y, z) = map(int, input().split())
	w = (z - y) / x
	print(math.floor(w))


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	c = c - b
	if c >= a:
		print(int(c / a))
	else:
		print('0')


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	print((c - b) // a)


n = int(input())
for i in range(n):
	c = 0
	(x, y, z) = map(int, input().split())
	c = z - y
	print(c // x)


t = int(input())
for i in range(t):
	(X, Y, Z) = map(int, input().split())
	val = int((Z - Y) / X)
	print(val)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split(' '))
	j = 0
	while j * x + y <= z:
		j = j + 1
	print(j - 1)


a = int(input())
for i in range(a):
	(x, y, z) = map(int, input().split())
	print((z - y) // x)


n = int(input())
for i in range(n):
	q = [0]
	(a, b, c) = map(int, input().split())
	for j in range(c):
		p = j * a + b
		if p <= c:
			q.append(j)
	print(max(q))


t = int(input())
for i in range(0, t):
	(x, y, z) = map(int, input().split())
	lists = []
	sums = 0
	while sums < z:
		if sums * x + y <= z:
			lists.append(sums)
		sums += 1
	print(max(lists))


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	if x + y > z:
		print('0')
	else:
		y = x + y
		y = z - y
		x = int(y / x)
		print(x + 1)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	print((c - b) // a)


for i in range(int(input())):
	(X, Y, Z) = map(int, input().split())
	no_of_mangoes = (Z - Y) // X
	print(no_of_mangoes)


T = int(input())
for i in range(T):
	(x, y, z) = [int(j) for j in input().split()]
	k = int((z - y) / x)
	print(k)


T = int(input())
for t in range(T):
	(X, Y, Z) = map(int, input().split())
	a = (Z - Y) // X
	print(a)


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split())
	capacity = Z - Y
	total = int(capacity / X)
	print(total)


for i in range(int(input())):
	(X, Y, Z) = map(int, input().split())
	if Y >= Z:
		print('0')
	else:
		print(int((Z - Y) / X))


t = int(input())
for i in range(t):
	(x, y, z) = list(map(int, input().split()))
	r = (z - y) / x
	print(int(r))


a = int(input())
for i in range(a):
	(z, x, c) = map(int, input().split())
	s = (c - x) // z
	print(s)


t = int(input())
while t:
	(x, y, z) = map(int, input().split())
	print(int((z - y) / x))
	t -= 1


n = int(input())
while n > 0:
	(a, b, c) = map(int, input().split())
	print((c - b) // a)
	n -= 1


for _ in range(int(input())):
	(x, y, z) = list(map(int, input().split()))
	print((z - y) // x)


t = int(input())
for i in range(0, t):
	(x, y, z) = list(map(int, input().split()))
	n = (z - y) / x
	print(int(n))


n = int(input())
for i in range(n):
	(a, b, c) = map(int, input().split())
	d = (c - b) // a
	print(d)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	if a == b and b == c:
		print('0')
	else:
		for i in range(max(a, b, c)):
			if i * a + b > c:
				break
		print(i - 1)


for i in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	d = c - b
	e = d // a
	print(e)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split(' '))
	(sum, c, c1) = (0, 1, 0)
	while sum <= z:
		sum = c * x + y
		c += 1
		c1 += 1
	print(c1 - 1)


n = int(input())
for i in range(n):
	lst = list(map(int, input().split()))[:3]
	for j in range(1, lst[2] + 1):
		if j * lst[0] + lst[1] > lst[2]:
			print(j - 1)
			break


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split(' '))
	expectedMango = (Z - Y) // X
	totalWeight = expectedMango * X + Y
	if totalWeight > Z:
		expectedMango = expectedMango - 1
	print(expectedMango)


T = int(input())
for i in range(T):
	(a, b, c) = list(map(int, input().split()))
	print((c - b) // a)


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split())
	A = Z - Y
	print(int(A / X))


d = int(input())
for l in range(d):
	(x, y, z) = map(int, input().split())
	print(int((z - y) / x))


T = int(input())
for i in range(T):
	(X, Y, Z) = map(int, input().split())
	if X + Y <= Z:
		A = Z - Y
		C = A / X
		print(int(C))
	else:
		print('0')


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	ans = z - y
	res = ans // x
	print(res)


t = int(input())
for i in range(t):
	(X, Y, Z) = list(map(int, input().split()))
	a = Z - Y
	print(a // X)


T = int(input())
for tc in range(T):
	(x, y, z) = map(int, input().split())
	print((z - y) // x)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	n = z - y
	tm = n // x
	print(tm)


t = int(input())
for i in range(t):
	(x, y, z) = map(int, input().split())
	p = z - y
	f = p // x
	print(f)