Problem
You and your pal are playing a jumping game. There are wooden plates in a row (where is an odd number). You jump into plate , and your friend jumps into plate . Then you jump into plate , and your friend follows you into plate , and so on.
The procedure comes to an end when someone is unable to make the following jump because the plate is occupied by someone else. Locate the last plate to be jumped into.
Input Format
- The first line comprises an integer , which represents the number of test cases. Then come the test cases.
- Each test case has a single line of input, containing a single number .
Output Format
For each test case, output in a single line the answer to the problem.
Constraints
- is odd
Subtasks
Subtask #1 (100 points): original constraints
Sample 1:
2 1 3
1 2
Explanation:
Test Case : Since there is only plate, that's the only one to be jumped into.
Test Case : The first player jumps into plate . The second player jumps into plate and finally, the first player jumps into plate . Then the second player cannot make another jump, so the process stops.
Program :
import java.util.*;
import java.lang.*;
class Wooden
{
public static void main(String[] args)
{
int t,n;
Scanner es=new Scanner(System.in);
t=es.nextInt();
for(int i=0;i<t;i++)
{
n=es.nextInt();
System.out.println((n/2)+1);
}
}
}
0 Comments