题目传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=3298

  博弈论经典结论题,我也没什么好说的。matrix67大佬比我想得深入的多:捡石子游戏、 Wythoff 数表和一切的 Fibonacci 数列

  代码:

#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<string>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#define ll long long
#define ull unsigned long long
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define lowbit(x) (x& -x)
#define mod 1000000007
#define inf 0x3f3f3f3f
#define eps 1e-18
#define maxn 2000010
inline ll read(){ll tmp=; char c=getchar(),f=; for(;c<''||''<c;c=getchar())if(c=='-')f=-; for(;''<=c&&c<='';c=getchar())tmp=(tmp<<)+(tmp<<)+c-''; return tmp*f;}
inline ll power(ll a,ll b){ll ans=; for(;b;b>>=){if(b&)ans=ans*a%mod; a=a*a%mod;} return ans;}
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void swap(int &a,int &b){int tmp=a; a=b; b=tmp;}
using namespace std;
int vis[maxn];
int a[maxn];
int n,m;
int main()
{
n=read(); m=read();
int now=;
for(int i=;;i++){
while(vis[now])++now;
if(now>n||now>m)break;
vis[now]=; vis[now+i]=;
a[now+i]=now; a[now]=now+i;
}
int t=read();
while(t--){
int n=read(),m=read();
if(a[n]==m)printf("Farmer John\n");
else printf("Bessie\n");
}
}

bzoj3298

【bzoj3298】[USACO 2011Open]cow checkers(博弈论)的更多相关文章

  1. BZOJ3298: [USACO 2011Open]cow checkers(佐威夫博弈)

    3298: [USACO 2011Open]cow checkers Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 195  Solved: 96[S ...

  2. BZOJ3298[USACO 2011Open]cow checkers——威佐夫博弈

    题目描述 一天,Besssie准备和FJ挑战奶牛跳棋游戏.这个游戏上在一个M*N的棋盘上, 这个棋盘上在(x,y)(0<=x棋盘的左下角是(0,0)坐标,棋盘的右上角是坐标(M-1,N-1). ...

  3. BZOJ3298: [USACO 2011Open]cow checkers 威佐夫博弈

    Description 一天,Besssie准备和FJ挑战奶牛跳棋游戏.这个游戏上在一个M*N的棋盘上, 这个棋盘上在(x,y)(0<=x棋盘的左下角是(0,0)坐标,棋盘的右上角是坐标(M-1 ...

  4. 3298: [USACO 2011Open]cow checkers

    3298: [USACO 2011Open]cow checkers Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 65  Solved: 26[Su ...

  5. bzoj 3298: [USACO 2011Open]cow checkers -- 数学

    3298: [USACO 2011Open]cow checkers Time Limit: 10 Sec  Memory Limit: 128 MB Description 一天,Besssie准备 ...

  6. [USACO11OPEN]奶牛跳棋Cow Checkers(博弈论)

    题目描述 One day, Bessie decides to challenge Farmer John to a game of 'Cow Checkers'. The game is playe ...

  7. LUOGU P3024 [USACO11OPEN]奶牛跳棋Cow Checkers

    题目描述 One day, Bessie decides to challenge Farmer John to a game of ‘Cow Checkers’. The game is playe ...

  8. [USACO 07NOV]Cow Relays

    Description For their physical fitness program, N (2 ≤ N ≤ 1,000,000) cows have decided to run a rel ...

  9. 【USACO】Cow Brainiacs

    题意描述 Cow Brainiacs 求 \(n!\) 在 \(b\) 进制表示下的第一位非 \(0\) 位的数字. 算法分析 闲话 忙人自动略过 之前做过一道 \(10\) 进制表示下的题目,感觉差 ...

随机推荐

  1. Poj1426

    Find The Multiple Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 25721   Accepted: 106 ...

  2. 通用且常用的Java正则匹配工具,用以检查邮箱名、电话号码、用户密码、邮政编码等合法性

    一个通用且常用的Java正则匹配工具,用以检查邮箱名.电话号码.用户密码.邮政编码等合法性. import java.util.regex.Matcher; import java.util.rege ...

  3. mybatis的oracle的in超过1000的写法

    <if test="preIds != null and preIds.size() > 0"> AND PRE_ID IN <trim suffixOve ...

  4. bootstrap-datetimepicker 滚动错位问题

    问题:在页面上弹出控件的时候,滚动后面页面,时间控件就会错位. 解决方法1: 搜索bootstrap-datetimepicker.js里面的"show:"方法,在this.pla ...

  5. 直播未来属于RTMP还是HTTP

    直播未来属于RTMP还是HTTP? - Tinywan - 博客园 https://www.cnblogs.com/tinywan/p/6122065.html 直播未来属于RTMP还是HTTP? H ...

  6. kafka-docker----(how to setup http proxy in container??)

    https://github.com/wurstmeister/kafka-docker environment: KAFKA_ADVERTISED_HOST_NAME: 10.10.160.243 ...

  7. paper reading:gaze tracking

    https://www.cv-foundation.org/openaccess/content_cvpr_2016/papers/Krafka_Eye_Tracking_for_CVPR_2016_ ...

  8. Tickets---hdu1260(简单dp)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1260 题意是有n个人排队买票,第 i 个人买票所需要的时间是a[i],这个人和 i-1 或者 i+1 ...

  9. 事件对象event之e.targtet || e.srcElement

    p.onclick = function (event) { var e = event || window.event, target = e.target ? e.target : e.srcEl ...

  10. gevent For the Working Python Developer

    Gevent指南   gevent程序员指南 由Gevent社区编写 gevent是一个基于libev的并发库.它为各种并发和网络相关的任务提供了整洁的API. 介绍 贡献者 核心部分 Greenle ...