hdu 4642 Fliping game 翻硬币游戏 抓住特征变量
2013-09-03 22:03
232 查看
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=4642
题解思路: 很容易得到,谁先把所有的硬币翻成反面朝上,谁就害得对方没办法继续下去,自己就获胜了,假设进行了K局,使得第一次全部的硬币都反面朝上了。事实上,k在比赛的一开始就确定好了,因为每次操作都会改变最右下角的那个1,0的奇偶性,那么最后一个数一开始是1,k必然是奇数,Alice获胜,一开始是0,k必然是偶数,Bob获胜。 嗯嗯,就这一点巧,感谢ChoiceZ的神YY~
代码:
题解思路: 很容易得到,谁先把所有的硬币翻成反面朝上,谁就害得对方没办法继续下去,自己就获胜了,假设进行了K局,使得第一次全部的硬币都反面朝上了。事实上,k在比赛的一开始就确定好了,因为每次操作都会改变最右下角的那个1,0的奇偶性,那么最后一个数一开始是1,k必然是奇数,Alice获胜,一开始是0,k必然是偶数,Bob获胜。 嗯嗯,就这一点巧,感谢ChoiceZ的神YY~
代码:
#include<iostream> #include<cstdio> #include<string> using namespace std; int main() { int T; cin>>T; int n,m; while(T--) { cin>>n>>m; getchar(); string s; for(int i=0;i<n-1;i++) { getline(cin,s); } int temp; for(int i=0;i<m;i++) cin>>temp; if(temp==1) cout<<"Alice"<<endl; else cout<<"Bob"<<endl; } }
相关文章推荐
- hdu 4642 Fliping game 翻硬币游戏 抓住特征变量
- hdu 4642 Fliping game 翻硬币游戏 抓住特征变量
- HDU 3537 Mock Turtles型翻硬币游戏
- hdu 3537 Daizhenyang's Coin(博弈-翻硬币游戏)
- HDU 3537 Daizhenyang's Coin (博弈论、翻硬币游戏)
- hdu 3537 Daizhenyang's Coin(博弈-翻硬币游戏)
- hdu 3537 Daizhenyang's Coin (翻硬币游戏)
- hdu 2209 翻纸牌游戏
- hdu 4559 涂色游戏(SG)
- hdu 3067 小t的游戏
- hdu 1281 棋盘游戏 (最大匹配,重要点)
- hdu 1007 Quoit Design(套圈游戏)
- iOS开发之特征变量(Use Trait Variations)
- qscoj 喵哈哈村的扔硬币游戏(区间更新)
- 2018山东冬令营:硬币游戏IV( 好题!)
- 敏捷游戏:从硬币游戏学习Scrum敏捷方法
- 51nod 1381 硬币游戏
- HDU 1079 日期游戏 博弈论相关
- hdu 2566 统计硬币
- HDU - 2566 统计硬币(常数时间解法)