308055: CF1459B. Move and Turn
Memory Limit:512 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Move and Turn
题意翻译
一个机器人站在二维平面的原点。 机器人每秒钟可以向东,西,南,北四个方向移动 $1$ 米。 第一步,机器人可以选择四个方向中的任何一个,但是在每一秒结束时,它必须向左或向右转 $90$ 度。例如,如果机器人只是向南或向北移动,下一步就必须向西或向东移动,反之亦然。 机器人按照上述规则从起始位置走出 $n$ 步。若机器人的最终方向忽略不计,它能到达多少个不同的终点?题目描述
A robot is standing at the origin of the infinite two-dimensional plane. Each second the robot moves exactly $ 1 $ meter in one of the four cardinal directions: north, south, west, and east. For the first step the robot can choose any of the four directions, but then at the end of every second it has to turn 90 degrees left or right with respect to the direction it just moved in. For example, if the robot has just moved north or south, the next step it takes has to be either west or east, and vice versa. The robot makes exactly $ n $ steps from its starting position according to the rules above. How many different points can the robot arrive to at the end? The final orientation of the robot can be ignored.输入输出格式
输入格式
The only line contains a single integer $ n $ ( $ 1 \leq n \leq 1000 $ ) — the number of steps the robot makes.
输出格式
Print a single integer — the number of different possible locations after exactly $ n $ steps.
输入输出样例
输入样例 #1
1
输出样例 #1
4
输入样例 #2
2
输出样例 #2
4
输入样例 #3
3
输出样例 #3
12