创建于 2026/07/18 · 更新于 2026/07/18
You are given two positive integers and . Initially, the set is
You may remove some numbers from . After doing so, you must ensure that for every pair of distinct remaining numbers and , their sum is not equal to any non-negative integer power of . In other words, there must be no integer such that
Find the minimum number of elements that must be removed.
You need to answer independent test cases.
The first line contains one integer , the number of test cases.
Each of the next lines contains two integers and , describing one test case.
For each test case, output one integer on a separate line: the minimum number of elements that must be removed.
3
4 1
4 2
4 3
0
1
1