F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Herbert

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 223    Accepted Submission(s): 46


Problem Description
Herbert is a game in which you control a robot on an infinite two-dimensional grid. There are three commands available to you:

s: Go one square forward in the current direction.

l: Turn ninety degrees counterclockwise.

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.
 

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

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

Output
For each test case:

One line with the number of reachable squares.
 

Sample Input
4 0 1 2 3
 

Sample Output
1 2 5 11
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-19 05:40:53, Gzip enabled