303255: CF630R. Game

Memory Limit:64 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Game

题意翻译

### 题目描述 学生与教授在$n×n(1<=n<=10^{18})$的棋盘上做游戏,教授给定$n$的值,学生可以选择是先手还是后手。规则如下: 两人轮流给棋盘上的格子染色,不能将已染色的格子的周围格进行染色。这里的周围格指的是有公共边的格子,也就是说仅有公共点的格子是可以染色的。谁没有格子染谁就输。 问:若两人都以最好的方式染色(也就是尽可能使自己赢),学生应该选择先手还是后手? ### 输入格式 一行一个整数$n$,表示棋盘的边长。 ### 输出格式 一行一个整数$1$或$2$,$1$表示学生应该选择先手,$2$反之。

题目描述

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.

输入输出格式

输入格式


The only line of the input contains one integer $ n $ ( $ 1<=n<=10^{18} $ ) — the size of the field.

输出格式


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

输入输出样例

输入样例 #1

1

输出样例 #1

1

输入样例 #2

2

输出样例 #2

2

Input

题意翻译

### 题目描述 学生与教授在$n×n(1<=n<=10^{18})$的棋盘上做游戏,教授给定$n$的值,学生可以选择是先手还是后手。规则如下: 两人轮流给棋盘上的格子染色,不能将已染色的格子的周围格进行染色。这里的周围格指的是有公共边的格子,也就是说仅有公共点的格子是可以染色的。谁没有格子染谁就输。 问:若两人都以最好的方式染色(也就是尽可能使自己赢),学生应该选择先手还是后手? ### 输入格式 一行一个整数$n$,表示棋盘的边长。 ### 输出格式 一行一个整数$1$或$2$,$1$表示学生应该选择先手,$2$反之。

加入题单

上一题 下一题 算法标签: