#K54012. Minimum Widgets to Inspect
Minimum Widgets to Inspect
Minimum Widgets to Inspect
You are given a series of test cases. In each test case, there are two integers \(n\) and \(k\), where \(n\) represents the total number of widgets and \(k\) represents the number of functional widgets. Your task is to determine the minimum number of widgets you need to inspect to be sure of finding at least one functional widget.
The answer for each test case is given by the formula:
[ \text{result} = n - k + 1 ]
Note that if there are no functional widgets (i.e., \(k=0\)), the formula still applies and will indicate that you need to inspect \(n+1\) widgets.
Example: For a test case where \(n=7\) and \(k=3\), the minimum number of inspections required is \(7 - 3 + 1 = 5\).
inputFormat
The first line of input contains a single integer \(T\) (the number of test cases). Each of the following \(T\) lines contains two space-separated integers, \(n\) and \(k\), representing the total number of widgets and the number of functional widgets, respectively.
outputFormat
For each test case, output a single line containing the minimum number of widgets that must be inspected.
## sample3
7 3
5 5
10 1
5
1
10
</p>