
博弈
superxtong
浮点猫
展开
-
HDU_1907&2509 博弈(Nim博弈变形)
JohnTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 4184 Accepted Submission(s): 2386Problem Description Little John is playing very funny原创 2016-07-27 00:25:43 · 241 阅读 · 0 评论 -
POJ1067之威佐夫博弈
题目传送门:http://poj.org/problem?id=1067主要求出当前是不是奇异局势就好啦~要用到黄金分割~代码:#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>const int MAXN=10000;using namespace std;原创 2016-07-28 00:20:43 · 280 阅读 · 0 评论 -
POJ1704之Nim博弈
题目传送门:http://poj.org/problem?id=1704模板题~#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>const int MAXN=1005;int a[MAXN];int num;using namespace std;vo原创 2016-07-28 00:22:56 · 282 阅读 · 0 评论 -
HDU2147之打表找规则
题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2147P点:就是P个石子的时候,对方拿可以赢(自己输的)N点:就是N个石子的时候,自己拿可以赢现在关于P,N的求解有三个规则(1):最终态都是P(2):按照游戏规则,到达当前态的前态都是N的话,当前态是P(3):按照游戏规则,到达当前态的前态至少有一个P的话,当前态是N题意:在一个m*n的棋盘内,从原创 2016-07-28 00:35:49 · 338 阅读 · 0 评论 -
HDU1846之巴什博弈
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1846简单题~#include <cstdio>#include <iostream>#include <algorithm>using namespace std;int main (void){ int t; int flag; cin>>t; while原创 2016-07-28 00:28:20 · 258 阅读 · 0 评论 -
HDU1847之SG值
题目传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1847模板题、#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>#include <cmath>const int MAXN=1005;using namespace std;int sg原创 2016-07-28 00:26:01 · 430 阅读 · 0 评论 -
POJ2505之找规律
题目传送门:http://poj.org/problem?id=2505看看代码就懂啦~。记得要向上取整~#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>const int MAXN=10000;using namespace std;int main (void){ long原创 2016-07-28 00:18:16 · 522 阅读 · 0 评论 -
POJ2975&HDU2176
题目传送门: http://poj.org/problem?id=2975 http://acm.hdu.edu.cn/showproblem.php?pid=2176因为两题都差不多,所以我就放在一起写啦。n堆石子,然后问如果必胜的话有多少种移动方法(一步)。 因为答案最多只有n,令ans=a1^a2^…^an。 如果需要构造出异或值为0的数,而且由于只能操作一堆石子,所以对于某堆石子ai原创 2016-07-27 23:56:55 · 344 阅读 · 0 评论 -
hdu1536-SG值
S-NimTime Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6549 Accepted Submission(s): 2772Problem Description Arthur and his sister Caroll have原创 2016-07-27 00:33:43 · 416 阅读 · 0 评论 -
POJ1740之构造博弈
题目传送门: http://poj.org/problem?id=1740从简单开始,首先,一堆的话先手必胜。如果有两堆,则只有两堆相同的时候先手会输。若两堆不同,先手可以造成两堆相同的局面从而不输。如果有三堆,先手可以拿走一堆并制造两堆相同的情况。我们发现,将n堆石子排序,如果石子数量对称,即每种数量的石子有偶数堆,则先手必输。 因为先手并不能取光所有的,而后手只要模仿先手的行为就能一直有石子原创 2016-07-28 01:21:07 · 343 阅读 · 0 评论