原题链接

R. Game
time limit per test

0.5 seconds

memory limit per test

64 megabytes

input

standard input

output

standard output

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.

Input

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

Output

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

Examples
input
1

output
1

input
2

output
2

For the field of an even size there is a winning strategy for the second player. Namely, to paint a cell that is symmetrical with respect to the center of the field to the cell painted by the first player on the previous turn. After each turn of the second player the field is centrosymmetrical and so there is always a cell that can be painted that is symmetrical with respect to the center of the field to any cell that the first player can choose to paint.

....  1...  .1..  ....  ....
....  ....  ....  1...  .1..
....  ....  ....  ...2  ..2.
....  ...2  ..2.  ....  ....

For the field of an odd size there is a winning strategy for the first player. Namely, on the first turn to paint the central cell, then to paint a cell that is symmetrical with respect to the center of the field to the cell painted by the second player on the previous turn. After each turn of the first player the field is centrosymmetrical and so there is always a cell that can be painted that is symmetrical with respect to the center of the field to any cell that the second player can choose to paint.

.....  2....  .2...  ..2..  .....
.....  .....  .....  .....  .2...
..1..  ..1..  ..1..  ..1..  ..1..
.....  .....  .....  .....  ...1.
.....  ....1  ...1.  ..1..  .....

n为奇数时先手赢,否则后手赢

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <deque>
#define maxn 100005
using namespace std;
typedef long long ll;int main(){ll n;scanf("%I64d", &n);if(n&1)puts("1");elseputs("2");return 0;
}

Experimental Educational Round: VolBIT Formulas Blitz-R. Game相关推荐

  1. Experimental Educational Round: VolBIT Formulas Blitz A

    Description The HR manager was disappointed again. The last applicant failed the interview the same ...

  2. [Educational Round 5][Codeforces 616F. Expensive Strings]

    这题调得我心疲力竭...Educational Round 5就过一段时间再发了_(:з」∠)_ 先后找了三份AC代码对拍,结果有两份都会在某些数据上出点问题...这场的数据有点水啊_(:з」∠)_[ ...

  3. Codeforces Educational Round 5

    Codeforces Educational Round 5 通过数: 4 Standing: 196/4176 题目链接: http://codeforces.com/contest/616 A: ...

  4. Educational Round 66 题解

    作为橙名来水了一发-- 这次题目就比上次良心多了.7题有5题会做. 然而风格仍然很怪异--还是练少了? A 水题.不过一开始没注意细节挂了几发,罚时罚的真痛-- 明显是能除以 $k$ 就除以 $k$, ...

  5. Codeforces Educational round 58

    Ediv2 58 随手AK.jpg D 裸的虚树,在这里就不写了 E 傻逼贪心?这个题过的比$B$都多.jpg #include <cstdio> #include <algorit ...

  6. CF Educational Round 23 F.MEX Queries

    写了3小时 = =.这两天堕落了,昨天也刷了一晚上hihocoder比赛,还爆了零.之后得节制点了,好好准备考研.. 首先很容易想到 压缩数据 + 线段树 然后对于Pushdown真很难写..需要牵涉 ...

  7. educational round 前缀和_总结分析634个以re为前缀的单词得出了re为前缀组合单词意思规律

    学英语需要有耐心.恒心!本文稍长!本文的目的所在是让读者在一篇文章里可以理解634个re前缀的单词,更重要的是可以复习到对应的634个常见的基础单词. 看下面的动图,小球从高点回到底部,从底部回到高点 ...

  8. Educational Round 64 题解

    前言: 这场太难了--我一个紫名只打出两题--(虽说感觉的确发挥不够好) 一群蓝绿名的dalao好像只打了两题都能升分的样子-- 庆幸的是最后A出锅然后unr了>///< 写一波题解纪念这 ...

  9. CodeForces616:Educational Round 5

    文章目录 前言 A Comparing Two Long Integers\text{A Comparing Two Long Integers}A Comparing Two Long Intege ...

最新文章

  1. C++核心编程(一)
  2. 中国书法的造型元素与原理 刘彦湖
  3. linux c内核开发,嵌入式uClinux的内核结构和开发环境
  4. Algorithm之PrA:PrA之nLP非线性规划算法+Matlab 优化工具箱的GUI求解非线性规划
  5. Node.js~ioredis处理耗时请求时连接数瀑增
  6. 算法讲解 -- 区间dp经典模型与优化(石子归并)
  7. 服务器上传至云系统,上传至云服务器命令
  8. echarts年龄饼图_echarts自定义饼图
  9. 用FolderBrowserDialog选择一个文件路径
  10. linux关于tcp协议ack的实现--总结和公平性问题
  11. json规范,平时不注意的特殊符号
  12. 化工自动化石油化工的全球与中国市场2022-2028年:技术、参与者、趋势、市场规模及占有率研究报告
  13. 用友致远A6协同管理软件操作手册
  14. h5课件制作_湘潭H5课件制作
  15. Linux内核“问题门”——学习问题、经验集锦(持续更新中……)
  16. 如何备份和还原PS4保存数据
  17. 微信小程序组件库——colorUI 的使用方法
  18. 学计算机基础word题,计算机操作基础Word练习题
  19. ctab法提取dna流程图_CTAB法提取植物DNA.ppt
  20. 练习-Java字符串之String类常用方法之文件名与邮箱验证

热门文章

  1. 永恒python太变态了_【图片】【教皇】【永恒】Python 全方位评测【反恐精英ol吧】_百度贴吧...
  2. 海外地址 | 使用鲸鱼地图将海外英文地址转为经纬度坐标
  3. 2B2T服务器需要正版登录吗,我的世界2b2t服务器怎么进才好?
  4. WEB快速学习(一)
  5. 机器人杆长标定_机器人校准系统
  6. 【计算机网络】常见状态响应码
  7. python做视频拼接
  8. 批量给图片名字为递增数字
  9. 32位计算机精度,16bit、24bit和32bit有什么区别?
  10. Openlab实验平台实验--使用Postman下发流表