QOJ.ac

QOJ

시간 제한: 1.0 s 메모리 제한: 256 MB 총점: 100

#15747. 红约翰游戏

통계

Red John 有一个无限大小的棋盘,以及 $n \times n$ 个棋子,排成一个 $n \times n$ 的正方形。棋子可以水平或垂直移动,移动方式是跳过一个(水平或垂直)相邻的棋子,并落到紧邻的下一个位置,前提是该位置没有被其他棋子占据。此外,当进行一次合法移动时,被跳过的棋子将被移除。你能否帮助 Red John 确定是否存在一种移动序列,使得棋盘上最终只剩下一个棋子?

下图展示了 $n = 2$ 时的一种移动序列。棋子用字母 P 表示。

n = 2 时的移动步骤示意图

输入格式

输入包含一个整数 $n$。

输出格式

如果存在一种移动序列使得棋盘上只剩下一个棋子,则输出 1;否则输出 0。输出中不能包含任何空格或换行符。

数据范围

对于 $100\%$ 的数据,满足 $0 < n < 10^9$。

样例

输入样例 1

3

输出样例 1

0

输入样例 2

4

输出样例 2

1

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.