Codeforces Beta Round #15-C. Industrial Nim
来源:互联网 发布:阿里云是什么 编辑:程序博客网 时间:2024/06/05 15:19
原题链接
求出每个dumper中的石头数进行异或,
对于x, x+1, x+2,...x+m进行异或,经过观察发现, a, a+1若a是偶数那么a^a+1必定为1,所以可以利用这个性质进行运算
#include <cstdio>#include <iostream>#define maxn 1005 #define MOD 1000000007typedef long long ll;using namespace std;int main(){//freopen("in.txt", "r", stdin);ll x, m, ans = 0;int n;scanf("%d", &n);while(n--){scanf("%I64d%I64d", &x, &m);if(x&1){ans ^= x;ll h = m - 1; h /= 2; if(h&1) ans ^= 1; if((m - 1) % 2) ans ^= x + m - 1;}else{ll h = m / 2;if(h&1) ans ^= 1;if(m % 2) ans ^= x + m - 1;}}if(ans) puts("tolik");else puts("bolik");return 0;}
0 0
- Codeforces Beta Round #15-C. Industrial Nim
- Codeforces 15C Industrial Nim
- CodeForces 15C. Industrial Nim
- Codeforces-15C Industrial Nim
- CodeForces 15C Industrial Nim
- CodeForces 15C Industrial Nim
- CodeForces 15C Industrial Nim
- codeforces 15C Industrial Nim(NIM 博弈)
- CodeForces 15C Industrial Nim (博弈)
- Codeforces 15C Industrial Nim 简单博弈
- Codeforces Beta Round #90 C题
- Codeforces Beta Round #1 A B C
- Codeforces Beta Round #1 A B C
- Codeforces Beta Round #2 A B C
- Codeforces Beta Round #90 C. Education Reform
- Codeforces Beta Round #2 C. Commentator problem
- Codeforces Beta Round #17 C. Balance DP
- Codeforces Beta Round #1 A,B,C
- svn如何提交.so文件
- tomcat用java启动
- 腾讯主机建站——搭建PHP环境及Mysql配置
- 第十一周--中序线索化二叉树的算法验证
- 错误信息 error: variably modified 'buf' at file scope char buf[bufsize];
- Codeforces Beta Round #15-C. Industrial Nim
- 去掉窗口的非客户区
- 第十周项目2--二叉树遍历的递归算法
- 第十一周项目一 线索化二叉树
- 架构优化之SERVICE 层分离----客户端
- 内置对象
- 第11周项目1 验证算法(4)哈夫曼编码的算法验证
- 程序员,这个双十一,对自己好一点…
- 第四章:Dubbo整合maven+spring+springmvc+mybatis之mybatis集成