正解:博弈论

解题报告:

传送门!

首先按照套路显然是考虑先预处理出所有数的$SG$函数值然后全局的$SG$就是$SG(n)$^$SG(m)$^$SG(p)$,这儿应该麻油问题$QwQ$?

然后就考虑怎么求$SG$函数?于是就直接$SG(x)=mex\{SG(x-y),y\in Fib,x\ge y\}$就好鸭$QwQ$

$over!$

#include<bits/stdc++.h>
using namespace std;
#define il inline
#define gc getchar()
#define ri register int
#define rb register bool
#define rc register char
#define rp(i,x,y) for(ri i=x;i<=y;++i) const int N=+;
int f[N],sg[N];
bool gdgs=,vis[N]; il int read()
{
rc ch=gc;ri x=;rb y=;
while(ch!='-' && (ch>'' || ch<''))ch=gc;
if(ch=='-')ch=gc,y=;
while(ch>='' && ch<='')x=(x<<)+(x<<)+(ch^''),ch=gc;
return y?x:-x;
}
il void pre()
{
f[]=;f[]=;rp(i,,)f[i]=f[i-]+f[i-];
rp(i,,){for(ri j=;f[j]<=i;++j)vis[sg[i-f[j]]]=;ri tmp=;while(vis[tmp])++tmp;sg[i]=tmp;for(ri j=;f[j]<=i;++j)vis[sg[i-f[j]]]=;}
} int main()
{
// freopen("1848.in","r",stdin);freopen("1848.out","w",stdout);
pre();
while(gdgs){ri m=read(),n=read(),p=read();if(!m && !n && !p)return ;printf(sg[m]^sg[n]^sg[p]?"Fibo\n":"Nacci\n");}
return ;
}

$HDU1848\ Fibonacci\ again\ and\ again$ 博弈论的更多相关文章

  1. 【博弈论】【SG函数】hdu1848 Fibonacci again and again

    某个状态的SG函数被定义为 除该状态能一步转移到的状态的SG值以外的最小非负整数. 有如下性质:从SG值为x的状态出发,可以转移到SG值为0,1,...,x-1的状态. 不论SG值增加与否,我们都可以 ...

  2. HDU1848 Fibonacci again and again SG函数

    Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Jav ...

  3. hdu-------(1848)Fibonacci again and again(sg函数版的尼姆博弈)

    Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Jav ...

  4. HDU1848 Fibonacci again and again(SG 函数)

    任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的: F(1)=1; F(2)=2; F(n)=F(n-1)+F(n-2)(n>=3); 所以,1, ...

  5. hdu1848 Fibonacci again and again [组合游戏]

    http://acm.hdu.edu.cn/showproblem.php?pid=1848 Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers) ...

  6. hdu1848 Fibonacci again and again(SG游戏功能)

    现在的变化是看不清楚SG功能什么寻求方法 临时模板标题是首当 性能mex1它正在寻求g(x) 然后XOR #include<cstdio> #include<iostream> ...

  7. HDU.1848.Fibonacci again and again(博弈论 Nim)

    题目链接 //求三堆石子的SG函数,异或起来就是整个游戏的SG值 #include <cstdio> #include <cstring> const int N=1005; ...

  8. HDU1848 Fibonacci again and again 博弈 SG函数

    题意:三堆石子,每次能拿走斐波那契数个石子,先取完石子胜,问先手胜还是后手胜  石子个数<=1000 多组数据 题目链接:http://acm.hdu.edu.cn/showproblem.ph ...

  9. 杭电ACM分类

    杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...

随机推荐

  1. PHP header 的7种用法

    这篇文章介绍的内容是关于PHP header()的7种用法 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下 PHP header 的7种用法 1. 跳转页面 header('Locat ...

  2. 1月北上广P2P平台之最 平台数成交量现双降

    1月北上广P2P平台之最 平台数成交量现双降   今日(2月9日),网贷之家联合盈灿咨询发布了<北上广地区P2P网贷行业2017年1月月报>.月报数据显示,截至2017年1月底,北京.上海 ...

  3. iPhone:constrainedToSize获取字符串的宽高

    在使用UILabel存放字符串时,经常需要获取label的长宽数据,本文列出了部分常用的计算方法. 1.获取宽度,获取字符串不折行单行显示时所需要的长度 CGSize titleSize = [aSt ...

  4. 2019-9-30-WPF-运行时迁移-EF-Core-数据库

    title author date CreateTime categories WPF 运行时迁移 EF Core 数据库 lindexi 2019-09-30 20:19:16 +0800 2019 ...

  5. Postman使用入门

    https://jingyan.baidu.com/article/0f5fb09907e3046d8334ea2f.html Postman测试管理的单位是测试集(Collections),测试集内 ...

  6. 学习CSS预处理器Less

    1.Sass与Less的区别:Sass与Less的区别 2.Less的使用:Less的使用 3.Less的相关网址:Less.js.Less中文网 Less的HSL函数-lighten():HSL函数 ...

  7. html--图片img

    一.图片的基本格式 当前万维网上流行的图像格式以GIF及JPEG为主,另外还有一个PNG.以下做分别介绍: 1.GIF格式:采用LZW压缩,是以压缩相同颜色的色块来减少图像大小的.(LZW压缩是一种能 ...

  8. artTemplate模版引擎的使用

    artTemplate: template.js 一款 JavaScript 模板引擎,简单,好用.提供一套模板语法,用户可以写一个模板区块,每次根据传入的数据,生成对应数据产生的HTML片段,渲染不 ...

  9. [转]解决pip安装太慢的问题

    阅读目录 临时使用: 经常在使用Python的时候需要安装各种模块,而pip是很强大的模块安装工具,但是由于国外官方pypi经常被墙,导致不可用,所以我们最好是将自己使用的pip源更换一下,这样就能解 ...

  10. 12627 - Erratic Expansion——[递归]

    Piotr found a magical box in heaven. Its magic power is that if you place any red balloon inside it ...