問題一覧 > 通常問題

No.1822 Keima of Shogi

レベル : / AI推定難易度 : 208 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 207
作問者 : Digwee_kkkn / テスター : NatsubiSogan
お気に入りにしたユーザー ProblemId : 7615 / 自分の提出
問題文最終更新日: 2022-01-28 23:11:38
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 329 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。