CF194B.Square
普及-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There is a square painted on a piece of paper, the square's side equals n 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) 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 4. The lower left square has two crosses. Overall John paints 17 crosses.
纸上画有一个正方形,其边长为 n 米。约翰·多伊(John Doe)在该正方形的周长上画叉号(×)。约翰首先在正方形的左下角画第一个叉号。然后他沿正方形周长按顺时针方向移动(即先向上、再向右、再向下、再向左,依此类推)。每次他行走 (n+1) 米后,便画一个叉号(参见图示以进一步理解)。
约翰仅当正方形左下角出现两个叉号时才停止。约翰总共会画多少个叉号?

图中展示了边长为 4 的正方形上约翰画叉号的顺序。左下角处有两个叉号。约翰总共画了 17 个叉号。
输入格式
The first line contains integer t (1 ≤ t ≤ 104) — the number of test cases.
The second line contains t space-separated integers n__i (1 ≤ n__i ≤ 109) — the sides of the square for each test sample.
第一行包含一个整数 t(1≤t≤104)—— 测试用例的数量。
第二行包含 t 个以空格分隔的整数 ni(1≤ni≤109)—— 每个测试样例中正方形的边长。
输出格式
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.
对每个测试样例,在一行中输出对应的答案,即约翰沿相应尺寸的正方形移动时所画的十字形数量。请按照输入中给出样例的顺序输出各样例的答案。
在 C++ 中,请勿使用 %lld 说明符读取或写入 64 位整数。推荐使用 cin、cout 流或 %I64d 说明符。
输入输出样例
输入#1
3 4 8 100
输出#1
17 33 401
输入解题思路,AI测评打分。不知道怎么写?