无意看到的题目.. 因为是中文的就猫了一眼, 觉得挺水就做做, 结果一做就是一下午.. NOI还有点名堂
开始觉得就是博弈+简单DP, 右图每一个格子 (a, b) , 玩家一次取石子以后能变成的状态是 (a-i, b) , (a, b-i) , 或者 (a-i, b-i) , 只要路线上存在lose, 赋值为win, 否则赋值lose. 整个表格是对称的. 自底向上DP就可以解决.
然后看了discuss, 存在O(1) 的算法..
Beatty sequence Wiki 讲解 , 看一下就了了..
The positive irrational number
generates the Beatty sequence
If
then
is also a positive irrational number. They naturally satisfy
and the sequences
and
form a pair of complementary Beatty sequences.
For r = the golden mean, we have s = r + 1. In this case, the sequence
, known as the lower Wythoff sequence, is
and the complementary sequence
, the upper Wythoff sequence, is
上下两个数列整好组成 lose 状态的坐标 (1,2) (3,5) (4,7) … 至于为什么等我有空会思考update一下 =D 好神奇阿
其中r是黄金分割律, 即 (1+sqrt(5))/2
则如果m在第一个数列里,则
m=[nr]=nr-x
m/r=n-x/r
其中x属于[0,1) , 先求出n再判断m/r是否在等式右边的区间里即可. 再返回n判断输入的b是否在二队列中相应的位置
Code:
[cpp]
#include <stdio.h>
#include <math.h>
#include <algorithm>
//return num in Beatty sequence(r=golden mean), -1 if not belong to
int Br(int m) {
static const double P=(1+sqrt(5.0))/2;
double foo=m/P;
int n=(int)foo;
if(foo-n>0.999999)
n++;
n++;
if(foo>(n-1/P))
return n;
else
return -1;
}
int main() {
int a,b;
while(scanf("%d%d",&a,&b)!=EOF) {
if(a>b)
std::swap(a,b);
int foo=Br(a);
bool win=true;
if(foo!=-1)
if(a+foo==b)
win=false;
if(win)
printf("1\n");
else
printf("0\n");
}
return 0;
}
[/cpp]
generates the Beatty sequence
then
is also a positive irrational number. They naturally satisfy
and
, known as the lower Wythoff sequence, is
, the upper Wythoff sequence, is
References:
Payid online pokies australia https://gitea.fefello.org/nathanwht50276
References:
Australian online pokies payid makemyjobs.in
References:
Payid pokies online https://git.teygaming.com/margueritebeal
References:
Payid withdrawal pokies https://pinecorp.com/
References:
Online pokies with payid australia real money https://dammsound.com
References:
Payid pokies instant withdrawal recruitment.talentsmine.net
References:
Lollybet Casino PayPal clients1.google.com.bd
References:
Lollybet Bonus ohne Einzahlung https://www.google.com.ua/
References:
Lollybet Casino 100 Freispiele gearguide.ru
References:
Lollybet Casino Roulette maps.google.com.ly
References:
Lollybet Casino Willkommensbonus https://91.cholteth.com/index/d1?diff=0&utm_clickid=cw0488o4c8wggkcc&aurl=https://moonlinky.com/isabellaol&an=&s=&pushMode=popup
References:
Lollybet Casino Zahlungsmethoden m.landing.siap-online.com
References:
Lollybet Casino Mindesteinzahlung google.nl
References:
Lollybet App https://ipeer.ctlt.ubc.ca/
References:
Lollybet Casino Erfahrungen millerovo161.ru
References:
Lollybet Mobile Casino http://forum.beersfan.ru/
References:
Lollybet Umsatzbedingungen http://www.google.ms
References:
Lollybet Casino Roulette http://shop2.parisyang.cafe24.com
References:
Lollybet Support http://clients1.google.gg
References:
Lollybet Casino mit Echtgeld http://de.thefreedictionary.com/_/cite.aspx?url=https://lollybet.com.de&word=Rumpf&sources=pons,farlex_partner_3,farlex_partner,kdict,open_thes,hc_De_En,DictCC
References:
Lollybet Casino Roulette optimize.viglink.com
References:
Lollybet Casino Mobile https://www.kerg-ufa.ru/component/content/article/16-news-kerg-ufa/271-v-novyj-god-na-novom-volkswagen.html?Itemid=101&tmpl=component&return_url=https://lnkup.my/enriquecatt529
References:
Lollybet Kundenservice auto.market.omk.ru
References:
Lollybet APK degeneratov.net
References:
Lollybet Casino Bonus ohne Einzahlung https://guru.sanook.com
References:
Lollybet No Deposit Bonus http://maps.google.com.bz
References:
Lollybet Kundenservice http://maps.google.lv/url?sa=t&source=web&rct=j&url=https://tinyurl.ee/iuzcara1753253
References:
Lollybet Casino Treueprogramm http://cse.google.com.nf/
References:
Crown casino perth work.buzzorbit.com
References:
William hill online casino https://jandlfabricating.com
References:
Tiger online check in https://cleveran.com/profile/vtdbrady000337
References:
Casino michigan https://eujobss.com/employer/bonus-3000-300-fs/
References:
Lollybet Casino Seriös http://cse.google.hn/
References:
Lollybet Casino Bonus ohne Einzahlung http://images.google.com.vn/url?sa=t&url=http://jobs.capsalliance.eu/employer/deine-online-spielothek/
References:
Lollybet Umsatzbedingungen clients1.google.gp
References:
Lollybet Casino Registrierung https://wiki.computacaonaescola.ufsc.br/