Problem Author: | Hasan Saleh (MathModel) |
Prepared by: | Hasan Saleh (MathModel) |
Edited by: | Hasan Saleh (MathModel) |
Solution
For the only choice is (a=b) and this case the answer is 1 anyways.
For other we've the following array assuming common difference :
now we want to determine that's a+(n-1)d \le b this gives us
and all d \in \{0,1,...,\left \lfloor \frac{b-a}{n-1} \right \rfloor\} will work thus the answer is \left \lfloor \frac{b-a}{n-1} \right \rfloor+1.
Complexity .
for _ in range(int(input())):
n,a,b=map(int,input().split())
if(n==1):
print(1)
continue
print((b-a)//(n-1)+1)