CF630R.Game

普及-

通过率:0%

时间限制:0.50s

内存限制:64MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There is a legend in the IT City college. A student that failed to answer all questions on the game theory exam is given one more chance by his professor. The student has to play a game with the professor.

The game is played on a square field consisting of n × n cells. Initially all cells are empty. On each turn a player chooses and paint an empty cell that has no common sides with previously painted cells. Adjacent corner of painted cells is allowed. On the next turn another player does the same, then the first one and so on. The player with no cells to paint on his turn loses.

The professor have chosen the field size n and allowed the student to choose to be the first or the second player in the game. What should the student choose to win the game? Both players play optimally.

IT City 学院有一个传说:一名在博弈论考试中未能答对所有题目的学生,会得到教授给予的最后一次机会。该学生需要与教授进行一场游戏。

游戏在一个由 n×nn \times n 个方格组成的正方形棋盘上进行。初始时所有方格均为空。在每一轮中,一名玩家选择一个空方格并将其涂色,要求该方格与之前已被涂色的任何方格均不共享边(即不能上下左右相邻);但允许对角相邻(即仅共享顶点)。下一轮由另一名玩家执行相同操作,然后轮到第一名玩家,依此类推。当某位玩家在自己的回合中无法涂色任何方格时,该玩家判负。

教授已选定棋盘尺寸 nn,并允许该学生选择自己作为先手玩家或后手玩家。为了获胜,该学生应如何选择?双方均采用最优策略。

输入格式

The only line of the input contains one integer n (1 ≤ n ≤ 1018) — the size of the field.

输入仅包含一行,其中有一个整数 nn(1 ≤ n ≤ 10181 ≤ n ≤ 10^{18})—— 表示棋盘的大小。

输出格式

Output number 1, if the player making the first turn wins when both players play optimally, otherwise print number 2.

如果先手玩家在双方都采取最优策略时获胜,则输出数字 1,否则输出数字 2。

输入输出样例

  • 输入#1

    1

    输出#1

    1
  • 输入#2

    2

    输出#2

    2

输入解题思路,AI测评打分。不知道怎么写?

首页