問題一覧 > 通常問題

No.1422 Social Distance in Train

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 266
作問者 : 👑 箱星 / テスター : 👑 Kazun
お気に入りにしたユーザー ProblemId : 5074 / 自分の提出
問題文最終更新日: 2022-04-25 23:55:01
Social Distance in Train
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. Show the original
yukicoder contest 286 (順位表) の他の問題:

Problem Statement

When $\left\lceil\frac{N}{2}\right\rceil$ people sit on a bench with $N$ seats so that no $2$ people are next to each other, how many possible states of occupied seats are there?

The following is a more rigorous statement. There is a bench with $N$ seats, numbered $1,2,\ldots,N$. For $i=1,2,\ldots,N-1$, seat number $i$ and seat number $i+1$ are adjacent. $\left\lceil\frac{N}{2}\right\rceil$ people each sit on one of the $N$ seats. No $2$ people may choose the same seat or adjacent seats. How many possible states of occupied seats are there? Here, $2$ states are considered different if there exists a number $i$ such that someone is sitting on seat $i$ in one state but no one is sitting on seat $i$ in the other.

Note that $\left\lceil\frac{N}{2}\right\rceil$ denotes the smallest integer greater than or equal to $\frac{N}{2}$.

Input

$N$

$N$ is an integer between $1$ and $10^9$, inclusive.

Output

Compute and print the number of possible states of occupied seats. Print a newline at the end.

Sample

Sample 1
Input
2
Output
2

When $1$ person sits on a bench with $2$ seats, there are $2$ possibilities: "the $1$st seat is occupied" and "the $2$nd seat is occupied".

Sample 2
Input
5
Output
1

When $3$ people sit on a bench with $5$ seats, there is only $1$ possibility: "seats number $1,3,5$ are occupied". Note that only whether each seat is occupied is considered, not who is sitting there.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。