摘要: 1 /* 2 HDU2516 取石子游戏 3 http://acm.hdu.edu.cn/showproblem.php?pid=2516 4 博弈论 斐波那契博弈 5 * 6 * 7 * 8 */ 9 #include 10 #include 11 #include 12 #include 13 #include 14 //#define test 1... 阅读全文
posted @ 2017-03-16 19:21 BBBob 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 HDU2188 选拔志愿者 3 http://acm.hdu.edu.cn/showproblem.php?pid=2188 4 博弈论 巴什博奕 5 巴什博奕要注意n 12 int main() 13 { 14 int t; 15 scanf("%d",&t); 16 while(t--) 17 { 18 int ... 阅读全文
posted @ 2017-03-16 11:24 BBBob 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 HDU2149 Public Sale 3 http://acm.hdu.edu.cn/showproblem.php?pid=2149 4 博弈论 巴什博奕 5 * 6 * 7 * 8 */ 9 10 11 #include 12 int main() 13 { 14 int m,n; 15 while(scanf("%d%d... 阅读全文
posted @ 2017-03-16 11:18 BBBob 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 HDU2147 kiki's game 3 博弈论 巴什博奕 4 http://acm.hdu.edu.cn/showproblem.php?pid=2147 5 题意:在一个n×m的棋盘上,初始棋子放在右上角, 6 先走到左下角的胜 7 打出胜负表: 8 n:必胜态 9 p:必败态 10 11 n n n n n 12 p ... 阅读全文
posted @ 2017-03-16 10:59 BBBob 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 HDU1846 Brave Game http://acm.hdu.edu.cn/showproblem.php?pid=1846 3 博弈论 巴什博奕 4 * 5 * 6 * 7 * 8 */ 9 #include 10 int main() 11 { 12 int t; 13 scanf("%d",&t); 14 int ... 阅读全文
posted @ 2017-03-16 08:13 BBBob 阅读(95) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 LightOJ1214 Large Division 3 http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1214 4 5 数论 同余定理 6 7 题意:大整数取余 8 * 9 * 10 * 11 * 12 */ 13 14 15 #include... 阅读全文
posted @ 2017-03-15 20:27 BBBob 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 POJ2480 Longge's problem 3 http://poj.org/problem?id=2480 4 数论 欧拉函数 线性筛 5 6 求sigma_i=1^n{gcd(i,n)} 7 sigma_d|n{d*phi(n/d)} 8 * 9 * 10 * 11 * 12 */ 13 #include 1... 阅读全文
posted @ 2017-03-15 00:36 BBBob 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 1 /* 2 HDU 5880 Family View 3 http://acm.hdu.edu.cn/showproblem.php?pid=5880 4 AC自动机 5 注意不要直接全把节点初始化,将其当做内存池来用, 6 用的时候再初始化,否则会MLE 7 */ 8 #include 9 #include 10 #include 11 #includ... 阅读全文
posted @ 2017-03-12 10:54 BBBob 阅读(246) 评论(0) 推荐(0) 编辑
摘要: /* LightOJ 1336 Sigma Function http://lightoj.com/login_main.php?url=volume_showproblem.php?problem=1336 数论 奇偶性 题目求f(n)为偶数的个数 我们发现如果f(n)为奇数,则n为x^2,2*x^2,2^x三种形式, 因为2^x中已经包含剩下两种, 所以只需求x^2和2*x^2的个... 阅读全文
posted @ 2017-03-09 17:25 BBBob 阅读(206) 评论(0) 推荐(0) 编辑
摘要: /* POJ 2478 Farey Sequence http://poj.org/problem?id=2478 欧拉函数 线性筛 原问题转化成1-n之间的欧拉函数和,因此利用线性筛在O(n)时间内求出其欧拉函数值 在求前缀和即可。 * * * */ #include #include using namespace std; const int Nmax=1000005; lon... 阅读全文
posted @ 2017-03-09 17:16 BBBob 阅读(134) 评论(0) 推荐(0) 编辑