2021 was approaching and the world was about to end. So 2 gods Saurabhx and Saurabhy (from Celesta) created the Cyberverse. But this time disappointed with humans both the gods decided not to have humans in this world. So they created a world of cyborgs. A world without humans. Isn’t it interesting? So let us dive into the cyberverse and have a look at their problems.
There are $N$ kid cyborgs with Chief Cyborg '100gods' and he has $K$ weapons with him. He wants to distribute those $K$ weapons among $N$ kid cyborgs. Since all the kid cyborgs are very good friends, so they set a rule among themselves for taking those weapons. The rule states that the difference between kid cyborg having the maximum weapons and the kid cyborg having minimum weapons should be less than or equal to $1$.

Find the value of the minimum number of weapons a kid cyborg can have when all the $K$ weapons are distributed among them.

-----Input:-----
- The first line contains an integer $T$, denoting the number of test cases.
- Each of the next $T$ lines will contain two space-separated integers denoting $N$ and $K$ respectively.

-----Output:-----
- For each test case ,output a single line containing an integer $X$ denoting the minimum number of weapons a kid cyborg can have in that test case.  

-----Constraints:-----
- $1 \leq T \leq 10^5$
- $1 \leq N \leq 10^5$
- $1 \leq K \leq 10^9$

-----Sample Input:-----
1
5 8

-----Expected Output:-----
1

-----Explanation-----
- There are $5$ kids and $8$ weapons.  
- Hence we will distribute the weapons such that $3$ kids have $2$ weapons each and the remaining $2$ kids have $1$ weapon each.  
- Hence the minimum number of weapons a kid cyborg has is $1$. (  That is, $min(1,2)$ = $1$ )

Source: codechef | Difficulty: EASY
Tags: Constructive algorithms

Mathematics

Ad-hoc


Solutions:
for t in range(int(input())):
	(n, k) = map(int, input().split())
	print(k // n)


t = int(input())
for i in range(0, t):
	s = input().split(' ')
	k = list(map(int, s))
	print(k[1] // k[0])


T = int(input())
for i in range(T):
	data = input().split()
	N = int(data[0])
	K = int(data[1])
	output = K / N
	print(int(output))


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


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


import math
t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	print(math.floor(k / n))


t = int(input())
i = 0
while i < t:
	(n, k) = map(int, input().split())
	print(k // n)
	i += 1


import math
for _ in range(int(input())):
	(a, b) = map(int, input().split())
	print(math.floor(b / a))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	print(k // n)


t = int(input())
for i in range(t):
	(n, k) = tuple(map(int, input().split()))
	print(k // n)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	k1 = k // n
	print(k1)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = k / n
	b = int(a)
	print(b)


def solve():
	(n, k) = [int(i) for i in input().split()]
	return k // n
t = int(input())
for _ in range(t):
	print(solve())


t = input()
t = int(t)
while t != 0:
	inp = input().split(' ')
	inp = [int(x) for x in inp]
	print(int(inp[1] / inp[0]))
	t -= 1


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n == 1:
		print(k)
	elif n > k:
		print(0)
	elif k % n != 0:
		print(k // n)
	else:
		print(k // n)


T = int(input())
for _ in range(T):
	(N, K) = map(int, input().split())
	print(K // N)


T = int(input())
for i in range(T):
	(N, K) = (int(x) for x in input().split())
	if N > K:
		print(0)
	else:
		print(K // N)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	x = k // n
	print(x)


for i in range(int(input())):
	NUMBER = input().split()
	CYBER_KIDS = int(NUMBER[0])
	WEAPONS = int(NUMBER[1])
	count = 0
	if WEAPONS < CYBER_KIDS:
		print(count)
	else:
		count = WEAPONS // CYBER_KIDS
		print(count)


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	print(K // N)


for i in range(int(input())):
	(k, w) = map(int, input().split())
	if k > w:
		print(0)
	else:
		print(w // k)


for i in range(int(input())):
	(l, n) = map(int, input().split())
	print(n // l)


for _ in range(int(input())):
	(n, w) = map(int, input().split())
	print(int(w / n))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	if n <= k:
		div = k // n
		rem = k % n
		if rem:
			maxx = div + 1
			minn = div
		else:
			maxx = div
			minn = div
	else:
		maxx = 1
		minn = 0
	print(minn)


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


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


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


Test = int(input())
for Cases in range(Test):
	(NumberofCyborgKids, NumberofWeapons) = map(int, input().split())
	Result = NumberofWeapons // NumberofCyborgKids
	print(Result)


for _ in range(int(input())):
	(kids, weapons) = map(int, input().split())
	print(weapons // kids)


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


import math
t = int(input())
for i in range(t):
	(N, K) = map(int, input().split())
	print(K // N)


import math
for test in range(int(input())):
	(n, k) = map(int, input().split())
	x = k / n
	print(math.floor(x))


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


for i in range(int(input())):
	(stu, gun) = map(int, input().split())
	print(gun // stu)


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


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


for i in range(int(input())):
	(n, w) = map(int, input().split())
	print(w // n)


for t in range(int(input())):
	(kids, weapons) = map(int, input().split())
	print(weapons // kids)


for i in range(int(input())):
	x = input().split(' ')
	a = int(x[0])
	b = int(x[1])
	print(b // a)


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


import math
T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	print(math.floor(K / N))


import math
try:
	t = int(input())
	for r in range(t):
		(n, k) = map(int, input().split())
		a = math.floor(k / n)
		b = math.ceil(k / n)
		print(min(a, b))
except:
	pass


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


for t in range(int(input())):
	(n, k) = [int(x) for x in input().rstrip().split()]
	print(k // n)


for case in range(int(input())):
	(n, k) = map(int, input().split())
	print(k // n)