Chef is currently standing at stair 0 and he wants to reach stair numbered X.

Chef can climb either Y steps or 1 step in one move.  
Find the minimum number of moves required by him to reach exactly the stair numbered X.

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

- The first line of input will contain a single integer T, denoting the number of test cases.
- Each test case consists of a single line of input containing two space separated integers X and Y denoting the number of stair Chef wants to reach and the number of stairs he can climb in one move.

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

For each test case, output the minimum number of moves required by him to reach exactly the stair numbered X.

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

$1 ≤ T ≤ 500$
$1 ≤ X, Y ≤ 100$

----- Sample Input 1 ------ 
4
4 2
8 3
3 4
2 1

----- Sample Output 1 ------ 
2
4
3
2

----- explanation 1 ------ 
Test case $1$: Chef can make $2$ moves and climb $2$ steps in each move to reach stair numbered $4$.

Test case $2$: Chef can make a minimum of $4$ moves. He can climb $3$ steps in $2$ of those moves and $1$ step each in remaining $2$ moves to reach stair numbered $8$.

Test case $3$: Chef can make $3$ moves and climb $1$ step in each move to reach stair numbered $3$.

Test case $4$: Chef can make $2$ moves and climb $1$ step in each move to reach stair numbered $2$.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
t = int(input())
for i in range(t):
	(x, y) = map(int, input().split(' '))
	m = x // y
	k = x % y
	print(m + k)


testcase = int(input())
while testcase > 0:
	(x, y) = map(int, input().split())
	remainder = x % y
	if x % y == 0:
		print(x // y)
	else:
		print(x // y + remainder)
	testcase -= 1


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	jumps = 0
	while x > 0:
		if x >= y:
			x -= y
			jumps += 1
		else:
			x -= 1
			jumps += 1
	print(jumps)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	m = x // y
	w = x % y
	if x % y == 0:
		print(x // y)
	else:
		print(m + w)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if x < y:
		print(x)
	else:
		print(int(x / y) + x % y)


for m in range(int(input())):
	(x, y) = map(int, input().split())
	print(x % y + x // y)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if x % y == 0:
		print(x // y)
	else:
		s = x // y
		n = s * y
		p = s + (x - n)
		print(p)


T = int(input())
for i in range(T):
	(x, y) = map(int, input().split())
	print(x % y + x // y)


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	if x % y == 0:
		print(x // y)
	else:
		print(x // y + x % y)
	t -= 1


for t in range(int(input())):
	(x, y) = map(int, input().split())
	print(x % y + x // y)


for _ in range(int(input())):
	(X, Y) = map(int, input().split())
	print(X // Y + X % Y)


t = int(input())
for i in range(0, t):
	stair = list(map(int, input().split()))
	if stair[0] % stair[1] == 0:
		print(stair[0] // stair[1])
	else:
		ekmin = stair[0] // stair[1]
		domin = stair[0] - ekmin * stair[1]
		print(ekmin + domin)


t = int(input())
for i in range(t):
	(X, Y) = map(int, input().split())
	print(X % Y + X // Y)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	if x < y:
		print(x)
	elif x == y:
		print(x // y)
	else:
		r = x % y
		q = x // y
		print(r + q)


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


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
	print(int(a % b + a / b))


t = int(input())
for i in range(t):
	(g, s) = map(int, input().split())
	if g % s == 0:
		print(g // s)
	else:
		r = g % s
		print(g // s + r)


t = int(input())
for i in range(t):
	(l, w) = map(int, input().split())
	print(l % w + l // w)


t = int(input())
for i in range(t):
	str = input()
	str = str.split()
	c = 0
	k = 0
	if int(str[0]) // int(str[1]) > 0:
		c = int(str[0]) // int(str[1])
		k = c * int(str[1])
	if k < int(str[0]):
		c = c + (int(str[0]) - k)
	print(c)


goals = int(input())
for distractions in range(goals):
	(life, wife) = map(int, input().split())
	print(life % wife + life // wife)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	l = []
	l1 = []
	if x % y == 0:
		print(x // y)
	elif y > x:
		print(x)
	else:
		for i in range(1, 100):
			if y * i < x:
				l.append(y * i)
				l1.append(i)
		p = max(l)
		p1 = max(l1)
		print(x - p + p1)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	print(x // y + x % y)


t = int(input())
for i in range(t):
	(X, Y) = map(int, input().split())
	if X < Y:
		print(X)
	elif X % Y == 0:
		print(X // Y)
	else:
		print(X // Y + X % Y)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	rem = x % y
	rem += x // y
	print(rem)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	k = x // y
	l = x % y
	if l == 0:
		print(k)
	else:
		print(k + l)


t = int(input())
while t > 0:
	(x, y) = map(int, input().split())
	c = 0
	s = 0
	c += x // y
	x -= x // y * y
	c += x
	print(c)
	t -= 1


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


for i in range(int(input())):
	(x, y) = map(int, input().split(' '))
	a = min(x // y + x % y, x)
	if x % y == 0:
		print(x // y)
	else:
		print(a)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	count = 0
	while x >= y:
		x -= y
		count += 1
	if x != 0:
		count += x
	print(count)


a = int(input())
for i in range(0, a):
	(l, m) = map(int, input().split())
	n = l % m + l // m
	print(n)


t = int(input(''))
for i in range(t):
	(x, y) = map(int, input('').split())
	reminder = x % y
	q = x // y
	print(reminder + q)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	if a % b == 0:
		print(int(a / b))
	elif a < b:
		print(a)
	else:
		c = int(a / b)
		print(c + a % b)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	if x % y == 0:
		print(int(x / y))
	elif x < y:
		print(x)
	elif x % y != 0:
		z = int(x / y)
		f = x - y * z
		print(z + f)


g = int(input())
for distractions in range(g):
	(l, w) = map(int, input().split())
	print(l % w + l // w)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if y > x:
		print(x)
	elif x % y == 0:
		print(x // y)
	else:
		b = x - x // y * y
		print(x // y + b)


n = int(input())
for i in range(n):
	(A, B) = map(int, input().split())
	print(A % B + A // B)


T = int(input())
for _ in range(T):
	(A, B) = map(int, input().split())
	if A % B == 0:
		print(A // B)
	else:
		print(A // B + A % B)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split())
	s = x // y
	s = x - y * s + s
	print(s)


t = int(input())
for _ in range(t):
	(x, y) = list(map(int, input().split()))
	print(x // y + x % y)


T = int(input())
for i in range(T):
	(x, y) = map(int, input().split(' '))
	if x >= y and x % y == 0:
		print(x // y)
	elif x > y and x % y != 0:
		print(x // y + x % y)
	elif x < y:
		print(x)


def jumps(x, y):
	y_steps = x // y
	total_steps = y_steps + (x - y_steps * y)
	return total_steps
t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split(' '))
	print(jumps(x, y))


t = int(input())
for _ in range(t):
	(x, y) = map(int, input().split())
	if x % y == 0:
		print(x // y)
	elif x < y:
		print(x)
	else:
		print(x // y + x % y)


for _ in range(int(input())):
	(height, steps_per) = map(int, input().split())
	print(height // steps_per + height % steps_per)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split(' '))
	steps = 0
	if a % b == 0:
		steps = steps + a // b
		print(steps)
	else:
		steps = steps + a // b + a % b * 1
		print(steps)


test = int(input())
for i in range(test):
	(x, y) = map(int, input().split())
	print(x % y + x // y)


T = int(input())
for n in range(T):
	num = input()
	asdf = num.split()
	(x, y) = list(map(int, asdf))
	moves = x // y + x % y
	print(moves)


h = int(input())
for i in range(h):
	(a, b) = map(int, input().split())
	print(a % b + a // b)


t = int(input())
for i in range(t):
	(x, y) = map(int, input().split(' '))
	a = x // y
	b = a + x % y
	print(b)