洛谷$P$2252 取石子游戏 博弈论
2024-09-06 15:23:32
正解:博弈论
解题报告:
威佐夫博弈板子昂$QwQ$
关于这一类问题也有个结论,是说,先手必败的状态一定形如$(\left \lfloor i+\phi \right \rfloor,\left \lfloor i+\phi^{2} \right \rfloor)$,然后$\phi=\frac{\sqrt{5}+1}{2}$
证是不会证的了,但找到了一篇证明看这个趴$QAQ$
#include<bits/stdc++.h>
using namespace std;
#define il inline
#define gc getchar()
#define ri register int
#define rb register bool
#define rc register char
#define rp(i,x,y) for(ri i=x;i<=y;++i) const double phi=(sqrt()+)/; il int read()
{
rc ch=gc;ri x=;rb y=;
while(ch!='-' && (ch>'' || ch<''))ch=gc;
if(ch=='-')ch=gc,y=;
while(ch>='' && ch<='')x=(x<<)+(x<<)+(ch^''),ch=gc;
return y?x:-x;
}
int main()
{
ri a=read(),b=read();if(a>b)swap(a,b);ri tmp=(b-a)*phi;
if(tmp==a)printf("0\n");else printf("1\n");
return ;
}
最新文章
- HP网络打印机--如何添加打印机
- MySQL学习笔记四:字符集
- 关于display:flex
- 10月16日下午MySQL数据库CRUD操作(增加、删除、修改、查询)
- property attribute: assign, strong, weak, unsafe_unretain and copy
- Modifiers: virtual, override, new, abstract, sealed, internal
- Python学习笔记6-字典
- Android ViewPager自动播放
- 转:关于Apache与Nginx的优势比较(经典)
- Spring – Sending E-Mail Via Gmail SMTP Server With MailSender--reference
- 人工智能2:智能Agent
- 希腊字母、拉丁字母、Markdown、拼写与读音中英对照表
- [Hadoop] - Hadoop3.0.x编译
- 创建docker公共仓库
- 存储区域网络(Storage Area Network,简称SAN)
- 【第六篇】SAP ABAP7.5x新语法之SQL注入
- Ehcache缓存配置和基本使用
- .NetCore 使用AutoMapper
- git配置教程
- Python 正则表达式学习摘要及资料
热门文章
- @loj - 2461@ 「2018 集训队互测 Day 1」完美的队列
- 爬虫:Selenium + PhantomJS
- oracle函数 decode(条件,值1,翻译值1,值2,翻译值2,...值n,翻译值n,缺省值)
- OpenStack☞网关协议
- js常见运算符
- Spring MVC 解决 Could not write JSON: No serializer found for class java.lang.Object
- PyCharm indexing goes into infinite loop pycharm 不同的indexing
- 接管SpringBoot对Activiti的数据源自动配置
- Python--day30--互联网协议与osi模型
- CSS 个性化滚动条样式