博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU - 1525 博弈 暴力分析
阅读量:4320 次
发布时间:2019-06-06

本文共 1401 字,大约阅读时间需要 4 分钟。

先来看看比较显然的几个局面

(a,0) 先手必败
(a,a) 先手必胜
(a,ak) 先手必胜
(a,ak+r),k>1 先手必胜,因为先手有主动权把(a,r)让给后手或留给自己

对于开局(a,r),r<a&&a/r<2,比较难分析,我们用暴力直接跑出结果

挑战程序设计竞赛把这种主动权成为自由度,名字真高端

这次的代码写的不怎么简练,不过能AC

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define rep(i,j,k) for(register int i=j;i<=k;i++)#define rrep(i,j,k) for(register int i=j;i>=k;i--)#define erep(i,u) for(register int i=head[u];~i;i=nxt[i])#define iin(a) scanf("%d",&a)#define lin(a) scanf("%lld",&a)#define din(a) scanf("%lf",&a)#define s0(a) scanf("%s",a)#define s1(a) scanf("%s",a+1)#define print(a) printf("%lld",(ll)a)#define enter putchar('\n')#define blank putchar(' ')#define println(a) printf("%lld\n",(ll)a)#define IOS ios::sync_with_stdio(0)using namespace std;const int maxn = 1e6+11;const int oo = 0x3f3f3f3f;const double eps = 1e-7;typedef long long ll;ll read(){ ll x=0,f=1;register char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f;}ll a,b;int main(){ while(cin>>a>>b){ if(a==0&&b==0) break; if(a
1)){ printf("Stan wins\n"); continue; } bool flag=0; while(1){ if(a
1)){ printf("%s wins\n",flag==0?"Ollie":"Stan"); break; } flag^=1; } } return 0;}

转载于:https://www.cnblogs.com/caturra/p/8658158.html

你可能感兴趣的文章
UVA 11346 Probability 概率 (连续概率)
查看>>
linux uniq 命令
查看>>
Openssl rand命令
查看>>
HDU2825 Wireless Password 【AC自动机】【状压DP】
查看>>
BZOJ1015: [JSOI2008]星球大战starwar【并查集】【傻逼题】
查看>>
HUT-XXXX Strange display 容斥定理,线性规划
查看>>
mac修改用户名
查看>>
一道关于员工与部门查询的SQL笔试题
查看>>
Canvas基础
查看>>
[Hive - LanguageManual] Alter Table/Partition/Column
查看>>
可持久化数组
查看>>
去除IDEA报黄色/灰色的重复代码的下划波浪线
查看>>
Linux发送qq、网易邮件服务配置
查看>>
几道面试题
查看>>
【转】使用 WebGL 进行 3D 开发,第 1 部分: WebGL 简介
查看>>
js用正则表达式控制价格输入
查看>>
chromium浏览器开发系列第三篇:chromium源码目录结构
查看>>
java开发操作系统内核:由实模式进入保护模式之32位寻址
查看>>
第五讲:单例模式
查看>>
Python编程语言的起源
查看>>