Topic Portal: https://www.lydsy.com/JudgeOnline/problem.php?id=3298
Game Theory Classic conclusion, I have nothing to say. Matrix67 bigger than I thought: the Stone game, Wythoff tables and all the Fibonacci series
Code:
#include <cstdio>#include<cmath>#include<cstdlib>#include<cstring>#include<ctime>#include<string>#include<iostream>#include<algorithm>#include<queue>#include<vector>#include<map>#definell Long Long#defineull unsigned long Long#defineMax (A, B) (A>B?A:B)#defineMin (A, b) (A<B?A:B)#defineLowbit (x) (x&-X)#defineMoD 1000000007#defineINF 0x3f3f3f3f#defineEPS 1e-18#defineMAXN 2000010inline ll read () {ll tmp=0;CharC=getchar (), f=1; for(;c<'0'||'9'<c;c=getchar ())if(c=='-') f=-1; for(;'0'<=c&&c<='9'; C=getchar ()) tmp= (tmp<<3) + (tmp<<1) +c-'0';returntmp*F;} Inline ll Power (ll A,ll b) {ll ans=1; for(; b;b>>=1){if(b&1) Ans=ans*a%mod; A=a*a%mod;}returnans;} inline ll gcd (ll A,ll b) {returnB?GCD (b,a%b): A;} InlinevoidSwapint&a,int&B) {intTmp=a; A=b; b=tmp;}using namespacestd;intVIS[MAXN];intA[MAXN];intn,m;intMain () {n=read (); m=read (); intnow=1; for(intI=1;; i++){ while(Vis[now]) + +Now ; if(now>n| | NOW>M) Break; Vis[now]=1; vis[now+i]=1; A[now+i]=now; a[now]=now+i; } intt=read (); while(t--){ intN=read (), m=read (); if(a[n]==m) printf ("Farmer john\n"); Elseprintf"bessie\n"); }}
bzoj3298
"bzoj3298" [Usaco 2011open]cow Checkers