No.1822 Keima of Shogi
タグ : / 解いたユーザー数 207
作問者 :
Problem Statement
There is an $N \times N$ grid ($N$ is odd). The cell in row $i$ and column $j$ is denoted by $(i,j) \ (0 \leq i, j < N)$.
Initially, a shogi piece called a "Keima" is placed on the cell $\left( N-1, \displaystyle \frac{N-1}{2} \right)$.
The Keima is a piece that can make the following move.
- If its current cell is $(i,j)$, it can move to the cell $(i-2,j-1)$ or the cell $(i-2,j+1)$.
Find the number of cells the Keima can reach, given that it may move any number of times.
Input
$N$
- $N$ is an odd number satisfying $3 \leq N \leq 10^9 + 1$
Output
Print the number of cells the Keima can reach on $1$ line.
Print a newline at the end.
Sample
Sample 1
Input
3
Output
3
In this case, the reachable cells, including the initial position, are the $3$ cells $(2,1), \ (0,0), \ (0,2)$.
Sample 2
Input
5
Output
6
In this case, the reachable cells, including the initial position, are the $6$ cells $(4,2), \ (2,1), \ (2,3), \ (0,0), \ (0,2), \ (0,4)$.
As with $(0,2)$, a cell the Keima can move to may coincide when moving from different cells ($(2,1), \ (2,3)$).
Sample 3
Input
1000000001
Output
125000000750000001
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。