try:
for i in range(int(input())):
n = int(input())
rem = 0
c = []
temp = 0
for A in range(2,n+1):
rem = n%A
if temp <= rem:
temp = rem
c.append((A,temp))
pkg = [p for p,q in c]
print(max(pkg))
except: pass
@parth111 actually, you have to find an O(1) solution in each test case as the no. of elements could be 10^8. I would suggest you formulate an equation such that only one package could be formed as it would enable the chef to each the most number of muffins.
1 Like
ok i will try