POJ 2505
#include<iostream>
#include<stdio.h>
using namespace std; int main()
{
//freopen("acm.acm","r",stdin);
unsigned num;
unsigned mod;
unsigned begin;
unsigned end;
int i;
i = ;
while(cin>>num)
{
begin = ;
end = ;
if(num >= && num <= )
{
cout<<"Stan wins."<<endl;
continue;
}
for(i = ; i < num; ++ i)
{
begin *= ;
end = begin*;
if(num >= begin+ && num <= end)
{
cout<<"Ollie wins."<<endl;
break;
}
begin = end;
end = begin*;
if(num >= begin+ && num <= end)
{
cout<<"Stan wins."<<endl;
break;
} }
}
}
/*
1 ----- 9 先胜
9+1 ------ 9*2 先负
9*2+1 ---- 9*2*9 先胜
9*2*9+1 ---- 9*2*9*2 先负
*/
POJ 2505的更多相关文章
- [原博客] POJ 2505 A multiplication game 组合游戏
题目链接题意: 有一个数p=1,甲乙两人轮流操作,每次可以把p乘2~9中的一个数,给定一个n,当一个人操作后p>=n,那么这个人赢,问先手是否必胜. 必胜状态:存在一种走法走到一个必败状态. 必 ...
- poj 2505 A multiplication game(博弈)
A multiplication game Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5622 Accepted: ...
- POJ 2505 A multiplication game(找规律博弈/贪心)
题目链接 #include<iostream> #include<cstdio> using namespace std; typedef long long ll; int ...
- poj 2505 A multiplication game
题目 题意:两个人轮流玩游戏,Stan先手,数字 p从1开始,Stan乘以一个2-9的数,然后Ollie再乘以一个2-9的数,直到谁先将p乘到p>=n时那个人就赢了,而且轮到某人时,某人必须乘以 ...
- POJ 2505 A multiplication game [博弈]
题意:两个人做游戏,每个人都可以在自己的回合里将数p乘以2到9之间的一个数,初始时p=1,谁先将p乘到大于等于n就算赢. 思路:一开始我算sg值,结果算来算去都没算明白... 后来看了别人题解,才豁然 ...
- poj 2505 乘法博弈论
转自:http://hzwer.com/1921.html 题目大意: 题意:Stan从1开始,可以乘上2~9中任何一个数,Ollie也如此操作,只到某个人本回合的操作超过N为之..1<N< ...
- SG函数和SG定理【详解】
在介绍SG函数和SG定理之前我们先介绍介绍必胜点与必败点吧. 必胜点和必败点的概念: P点:必败点,换而言之,就是谁处于此位置,则在双方操作正确的情况下必败. N点:必胜点 ...
- (转载)--SG函数和SG定理【详解】
在介绍SG函数和SG定理之前我们先介绍介绍必胜点与必败点吧. 必胜点和必败点的概念: P点:必败点,换而言之,就是谁处于此位置,则在双方操作正确的情况下必败. N点:必胜点 ...
- 组合游戏 - SG函数和SG定理
在介绍SG函数和SG定理之前我们先介绍介绍必胜点与必败点吧. 必胜点和必败点的概念: P点:必败点,换而言之,就是谁处于此位置,则在双方操作正确的情况下必败. N点:必胜点 ...
随机推荐
- while (~scanf("%d%d",&m,&n))什么用的?
ACM中比较常见,其功能是循环从输入流读取m和n,直到遇到EOF为止,等同于while (scanf("%d%d",&m,&n)!=EOF). scanf()函数返 ...
- centos firewalld 基本操作【转】
1.firewalld的基本使用启动: systemctl start firewalld关闭: systemctl stop firewalld查看状态: systemctl status fire ...
- ubuntu彻底删除apache2 再重装
删除apache2不彻底,导致用 apt-get install apache2 重新装时总是不成功.下面是如何彻底删除apache2 1. 删除apache 代码: $ sudo apt-get - ...
- gj12-2 协程和异步io
12.3 epoll+回调+事件循环方式url import socket from urllib.parse import urlparse # 使用非阻塞io完成http请求 def get_ur ...
- typecho开启pjax,ajax,无刷新
1.引入jquery和pjax 检查你的网站是否引入1.7.0版本以上的jquery.js,如果没有请全局引入 https://files.cnblogs.com/files/fan-bk/pjax. ...
- Windows下Python安装: requires numpy+mkl 和ImportError: cannot import name NUMPY_MKL
最近写了一篇关于“微软开源分布式高性能GB框架LightGBM安装使用”的文章,有小伙伴安装Python环境遇到了问题.我个人也尝试安装了一下,确实遇到了很多问题."Windows7下pyt ...
- poj 3278 Catch That Cow(bfs+队列)
Description Farmer John has been informed of the location of a fugitive cow and wants to catch her i ...
- 快速创建一个 spring mvc 示例
1. 创建一个 servlet 项目 参考 http://www.cnblogs.com/zno2/p/5908589.html 2. 引入 spring mvc 依赖 <dependency& ...
- MIT Molecular Biology 笔记2 DNA的突变和修复
视频 https://www.bilibili.com/video/av7973580?from=search&seid=16993146754254492690 教材 Molecular ...
- 20169207《Linux内核原理及分析》第十二周作业
本周选做的信息安全实验为Python实现Zip文件的暴力破解 实验预备: 这次实验我们需要用到的库为zipfile.下来我们先来了解一下这个模块. 首先我们的重点是对zip文件的操作,而zipfile ...