#P15785. [JAG 2025 Summer Camp #3] Max of Mod
[JAG 2025 Summer Camp #3] Max of Mod
题目描述
You are given a set of integers . As long as does not contain , you can repeatedly perform the following operation:
Choose a positive integer less than or equal to the maximum value in , and replace each element of with its remainder when divided by .
Determine the maximum number of operations that can be performed.
输入格式
The input consists of multiple test cases.
The first line contains an integer (), representing the number of test cases.
test cases follow. Each test case is given in the following format.
For each test case, the only line contains integers and (), representing the minimum and maximum values of the set, respectively.
输出格式
For the test cases, output the answers separated by newlines. For each test case, output the maximum number of operations that can be performed.
3
7 10
1 2718
20250913 20250915
2
1
23