山东省第八届ACM省赛A.Return of the Nim
来源:互联网 发布:数据分析入门书籍 编辑:程序博客网 时间:2024/05/29 07:00
题目
当n=2的时候是威佐夫博弈。其他时候都是nim博弈。(说起来多容易,呵呵哒)
#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>using namespace std;int a[35];int main(){ int t; while(~scanf("%d",&t)) { int n; while(t--) { scanf("%d",&n); memset(a,0,sizeof a); if(n==2) { int a,b; scanf("%d %d",&a,&b); int x=max(a,b); int y=min(a,b); int z=x-y; int w=(int)(((sqrt(5)+1)/2)*z); if(w==y) printf("Watson\n"); else printf("Sherlock\n"); continue; } int ans=0; for(int i=0;i<n;i++) { scanf("%d",&a[i]); ans^=a[i]; } if(ans==0) printf("Watson\n"); else printf("Sherlock\n"); } }}
阅读全文
0 0
- 山东省第八届ACM省赛A.Return of the Nim
- 山东省第八届acm省赛 Return of the Nim
- SDUT 3893 (山东省第八届ACM省赛A题) Return of the Nim 博弈nim+威佐夫
- ACM 第八届山东省赛 A题 Return of the Nim
- 山东省第八届省赛A题 Return of the Nim
- 2017第八届浪潮杯山东省赛 A.Return of the Nim 博弈
- Return of the Nim----Nim博弈+威佐夫博弈 山东省第八届省赛A题
- 山东省第八届省赛 Return of the Nim(博弈)
- Return of the Nim 山东省赛
- 山东省第八届ACM省赛A题
- 【补题】2017山东省赛A题 Return of the Nim
- 山东省第八届acm省赛A题 博弈
- 省SD2017 A Return of the Nim【威佐夫博弈+NIM】
- 山东省第七届ACM省赛------Triple Nim
- 山东省第七届ACM省赛 Triple Nim
- Return of the Nim
- Return of the Nim
- 2017 省赛 山东 A Return of the Nim 【博弈】【Nim+Wythoff】
- java servlet 与前端json数据传输ajax、jquery
- android中Parcelable接口的使用
- “Naive”贝叶斯算法 —— 朴素贝叶斯(Naive Bayesian)算法
- concurrent.locks使用详解
- 字典树
- 山东省第八届ACM省赛A.Return of the Nim
- JNDI
- Sql中DDL、DML、DCL介绍
- android版本号
- spring_SSH整合之_架构的历史(架构整合JSP+Hibernate+Spring+Struts2+DTO)_9
- Warning: Each child in an array or iterator should have a unique "key" prop.
- Linux设置有效的防火墙策略禁止所有非法的请求
- ARM Linux中断机制之中断处理
- 搭建Linux服务器下网站