CodeForces 630R-Game
来源:互联网 发布:linux用办公软件 编辑:程序博客网 时间:2024/06/11 18:01
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 ≤ 1018) — the size of the field.
Output number 1, if the player making the first turn wins when both players play optimally, otherwise print number2.
1
1
2
2
#include<stdio.h>#include<string.h>#include<algorithm>#define LL long long using namespace std;int main(){LL n;while(scanf("%lld",&n)!=EOF){if(n%2==0){printf("2\n");}elseprintf("1\n");}return 0;}
- Codeforces 630R Game
- CodeForces 630R-Game
- codeforces 630R Game
- Codeforces 630R Game
- CodeForces 630R:Game【水】
- CodeForces 630 R. Game【博弈】
- CodeForces 630 R. Game(博弈论)
- CodeForces - 630R Game (规律)水
- codeforces 214C Game
- codeforces Epic Game 题解
- codeforces Flipping Game 题解
- codeforces a 24 game
- 【CodeForces】Plate Game(博弈)
- 【CODEFORCES】 C. 24 Game
- CodeForces -Game on Paper
- CodeForces - 513A Game
- Codeforces 570B__Simple Game
- CodeForces 570BSimple Game
- iOS动画
- 数据结构——两栈共享一个数组的学习
- 分支、主干合并(SVN)
- Java Spring 框架整理
- java得到视频时间
- CodeForces 630R-Game
- 怎样启动 停止 重启MySQL数据库服务器
- Java提高篇—–Java集合细节(三):subList的缺陷
- CART: 分类与回归树
- MYSQL数据库报错集合
- android ToastShow 直接切换文字,不闪烁
- windows常用快捷键
- 在ASP.NET程序中存储和调用word文件
- github客户端上传代码 mac 注意事项