CF1459B.Move and Turn

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

A robot is standing at the origin of the infinite two-dimensional plane. Each second the robot moves exactly 11 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 nn 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 nn ( 1n10001 \leq n \leq 1000 ) — the number of steps the robot makes.

输出格式

Print a single integer — the number of different possible locations after exactly nn steps.

输入输出样例

  • 输入#1

    1

    输出#1

    4
  • 输入#2

    2

    输出#2

    4
  • 输入#3

    3

    输出#3

    12

说明/提示

In the first sample case, the robot will end up 1 meter north, south, west, or east depending on its initial direction.

In the second sample case, the robot will always end up 2\sqrt{2} meters north-west, north-east, south-west, or south-east.

首页