No.1491 Silver General
タグ : / 解いたユーザー数 216
作問者 :
penguinman
/ テスター :
kaage
kichi2004_
Problem Statement
In shogi, there is a piece called the silver general, which moves as follows.
Let us move this piece on an infinitely extending two-dimensional plane.
When the silver general is at coordinates $(x,\ y)$, in $1$ operation you can move it to any one of the following $5$ coordinates (these correspond to the figure above).
- $(x,\ y+1)$
- $(x+1,\ y+1)$
- $(x-1,\ y+1)$
- $(x+1,\ y-1)$
- $(x-1,\ y-1)$
Now, the silver general is placed at the origin of the two-dimensional plane. How many coordinates can the silver general reach in at most $K$ operations?
Input
\(K\)
- $1\leq K\leq 10^9$
- $K$ is an integer.
Output
Output the number of coordinates the silver general can reach in at most $K$ operations.
Sample
Sample 1
Input
1
Output
6
The figure in the problem statement makes this easy to see.
Sample 2
Input
3
Output
38
Sample 3
Input
998244353
Output
3985967153185554438
The answer can be very large.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。