1783. Herbert

单点时限: 3.0 sec

内存限制: 256 MB

Herbert is a game in which you control a robot on an infinite two-dimensional grid. There

are three commands available to you:

  1. s: Go one square forward in the current direction.

  2. l: Turn ninety degrees counterclockwise.

  3. r: Turn ninety degrees clockwise.

After playing this game for a while, you wonder how many squares you can reach within a

certain number of moves. Write a program to calculate the answer to this question.

输入格式

On the first line an integer t (1 _ t _ 100): the number of test cases. Then for each test

case:

  1. One line with an integer n (0 _ n _ 1 000 000 000): the maximum number of moves.

输出格式

For each test case:

  1. One line with the number of reachable squares.

样例

Input
4
0
1
2
3
Output
1
2
5
11

1 人解决,5 人已尝试。

2 份提交通过,共有 6 份提交。

9.9 EMB 奖励。

创建: 17 年前.

修改: 7 年,2 月前.

最后提交: 17 年前.

来源: BAPC 2007

题目标签