CF194B.Square

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There is a square painted on a piece of paper, the square's side equals nn meters. John Doe draws crosses on the square's perimeter. John paints the first cross in the lower left corner of the square. Then John moves along the square's perimeter in the clockwise direction (first upwards, then to the right, then downwards, then to the left and so on). Every time he walks (n+1)(n+1) meters, he draws a cross (see picture for clarifications).

John Doe stops only when the lower left corner of the square has two crosses. How many crosses will John draw?

The figure shows the order in which John draws crosses for a square with side 44 . The lower left square has two crosses. Overall John paints 1717 crosses.

输入格式

The first line contains integer tt ( 1<=t<=1041<=t<=10^{4} ) — the number of test cases.

The second line contains tt space-separated integers nin_{i} ( 1<=ni<=1091<=n_{i}<=10^{9} ) — the sides of the square for each test sample.

输出格式

For each test sample print on a single line the answer to it, that is, the number of crosses John will draw as he will move along the square of the corresponding size. Print the answers to the samples in the order in which the samples are given in the input.

Please do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use the cin, cout streams or the %I64d specifier.

输入输出样例

  • 输入#1

    3
    4 8 100
    

    输出#1

    17
    33
    401
    
首页