无意看到的题目.. 因为是中文的就猫了一眼, 觉得挺水就做做, 结果一做就是一下午.. 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:
KingMaker Casino Registrieren maps.google.com.hk
References:
Legiano Casino Willkommensbonus maps.google.com.ng
References:
Kingmaker casino echtgeld spielen einzahlung http://img.2chan.net/bin/jump.php?https://readeach.com/utacreel108637
References:
KingMaker Casino Einzahlung per Klarna maps.google.ng
References:
Kingmaker Casino Auszahlung http://clients1.google.com.gi/url?q=https://l2l.li/gilbertodufaur
References:
Kingmaker Casino Einzahlung http://clients1.google.com.gh/
References:
KingMaker Casino Registrierungsbonus https://wiki.hetzner.de/api.php?action=https://searl.co/anja360726813
References:
Legiano Casino Auszahlung Dauer http://clients1.google.gp/url?q=https://drake-jakobsen-2.thoughtlanes.net/legiano-casino-test-modernes-online-casino-deutschland
References:
Legiano Casino Auszahlung https://forum.reizastudios.com
References:
Legiano Casino Login Deutschland https://structurizr.com/
References:
KingMaker willkommensbonus shop2.parisyang.cafe24.com
References:
Monro Casino Download eda.europa.eu
References:
Hit n spin casino online login http://images.google.co.kr/url?q=https://tdec.tn.gov/single_signon/Account/LogIn?returnurl=https://de.trustpilot.com/review/der-wikinger-shop.de
References:
Hit’n’spin casino 25 euro bonus ohne einzahlung http://maps.google.com.sl/
References:
Hit n spin casino bonus http://alt1.toolbarqueries.google.mn/
References:
Monro Casino No Deposit Bonus rezkyrizani.xtgem.com
References:
Hitnspin casino legal http://www.dftgroupsvn.uniroma2.it/search?q=https://wikisoporte.fcaglp.unlp.edu.ar/api.php?action=https://de.trustpilot.com/review/der-wikinger-shop.de
References:
Hitnspin casino registrierung tehnologiya.ucoz.ru
References:
Hit’n’spin casino login cerldev.kek.jp
References:
Hitnspin casino gutscheincode https://www.ironhidegames.com/external?url=https://atomcraft.ru/user/candlewasher8/
References:
Hit n spin casino app https://tonelib.net/forums/proxy.php?link=https://www.haphong.edu.vn/profile/bernardtkamorales50410/profile
References:
Hit n spin casino 25 euro code http://www2a.biglobe.ne.jp/
References:
Hitnspin casino willkommensbonus http://uma.y.ribbon.to/news/re.php?URL=https://www.orkhonschool.edu.mn/profile/oconnorgbjenevoldsen8519/profile
References:
Hitnspin casino spielautomaten http://toolsyep.com/de/open-graph-vorschau/?u=https://philosophywiki.space/wiki/Unsere_TopAuswahl_fr_Mobilgerte_LiveSpiele
References:
Hitnspin casino spielautomaten forum.kurs.expert
References:
Hitnspin casino login tfw2005.com
References:
Hit’n’spin casino 25 euro bonus ohne einzahlung
xgm.guru
References:
Hitnspin casino kostenlos spielen https://en.asg.to
References:
Hit n spin no deposit bonus imslp.org
References:
Hitnspin verifizierung https://docs.shinobi.video/
References:
Hitnspin casino app https://yandex.com.am
References:
Hit n spin freispiele http://akmrko.ru/bitrix/click.php?goto=https://telegra.ph/Bonus-800–300-Freispiele-06-07-3
References:
Lollybet Casino toolbarqueries.google.com.eg
References:
Lollybet Bonus ohne Einzahlung http://www.liveinternet.ru/
References:
Lollybet Casino Paysafecard http://maps.google.ci/url?q=https://may22.ru/user/pricesweets3/
References:
Lollybet Casino Sicherheit http://maps.google.com.bn/
References:
Lollybet Casino Aktion images.google.co.th
References:
Lollybet Casino Lizenz reshalkino.ru
References:
Lollybet Casino Promo Code clients1.google.nr
References:
Lollybet Casino App Download https://rcin.org.pl/
References:
Hitnspin bewertung clients1.google.kg
References:
Hitnspin casino ohne anmeldung http://cse.google.com.kh/
References:
Hit n spin casino login http://cse.google.co.zm/url?sa=t&url=https://dailybeacon.site/item/alle-infos
References:
Hitnspin casino http://alt1.toolbarqueries.google.tk/
References:
Hitnspin casino bonus ohne einzahlung http://clients1.google.ki/url?q=https://pad.geolab.space/s/XAWKq8gc7R
References:
Hitnspin casino app images.google.as
References:
Hitnspin casino mit echtgeld http://hezuo.xcar.com.cn/
References:
Hitnspin casino auszahlungslimit image.google.je
References:
Payid pokies list https://buzzhy.com
References:
Payid pokies aus https://healthjobslounge.com/employer/instant-payid-withdrawal-casino-australia-real-money-2026/