【編程題解】Pig likes running

Description

Popo is a maverick pig who runs around an n*n outside of the field every day.

Everytime it runs n+1 unit length, it will take a break at that location.

When it rests at a certain point for the second time, it will end today's running.

Obviously when n is certain, the number of rests per day is also certain.

Can you figure out how many times it has to take a rest every day, and of course you have to count the last repeated rest.

 

Input

The first line contains a positive integer t, indicating the number of queries.

The second line contains t integers, separated by spaces, and each integer represents n given by a query.

Data range:1≤t≤10000,1≤n≤1000

 

Output

There are t lines of output.

Each row contains a positive integer, where the integer in the i-th row represents the answer to the i-th query.

Sample Input 1 

4
3 4 6 8

Sample Output 1

4
17
25
33

 

Personal Answer  (using language:JAVA)  Not necessarily right

public class Main {
    public static void main(String[] args) {
        System.out.println("Unsolved");
    }
}

Welcome to communicate!

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章