随笔分类 -  ACM算法

摘要:理论分析 问题:首先有两堆石子,博弈双方每次可以取一堆石子中的任意个,不能不取,或者取两堆石子中的相同个。先取完者赢。 分析:首先我们根据条件来分析博弈中的奇异局势 第一个(0 , 0),先手输,当游戏某一方面对( 0 , 0)时,他没有办法取了,那么肯定是先手在上一局取完了,那么输。 第二个(1, 阅读全文
posted @ 2018-02-13 19:20 TQCAI 阅读(404) 评论(0) 推荐(1)
摘要:问题描述: 有一堆物品,共n个,两人轮流从这堆物品中取,规定每次至少取一个,至多m个,获胜条件分为两种,分别是最后取光者胜或者是最后取光者败。 情形一:最后取光者胜 分析: 若n=m+1,则无论先手取走多少,后手一定可以一次性取走剩下的全部物品,这时后手胜; 若n=(m+1)*r+s,且s<=m,r 阅读全文
posted @ 2018-02-13 15:05 TQCAI 阅读(773) 评论(0) 推荐(0)
摘要:1.三国游戏(完全信息静态博弈) 代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #inc 阅读全文
posted @ 2018-02-13 13:31 TQCAI 阅读(237) 评论(0) 推荐(0)
摘要:1.TOYS 双语描述: Calculate the number of toys that land in each bin of a partitioned toy box. 计算一个分区玩具箱每个箱子里的玩具数量。 Mom and dad have a problem - their chil 阅读全文
posted @ 2018-02-12 12:31 TQCAI 阅读(261) 评论(0) 推荐(1)
摘要:1.最大正方形 我的瞎猜分析: 我的瞎猜算法: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> # 阅读全文
posted @ 2018-02-10 20:57 TQCAI 阅读(366) 评论(0) 推荐(0)
摘要:1.数字三角形 学习链接:http://blog.csdn.net/zwhlxl/article/details/46225947 输入样例: 输出样例: 递归代码: #include <stdio.h> #include <memory.h> #include <math.h> #include 阅读全文
posted @ 2018-02-10 11:54 TQCAI 阅读(255) 评论(0) 推荐(0)
摘要:1.尼克的任务 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> 阅读全文
posted @ 2018-02-09 10:42 TQCAI 阅读(221) 评论(0) 推荐(0)
摘要:1.直线取石子 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> 阅读全文
posted @ 2018-02-08 14:11 TQCAI 阅读(617) 评论(0) 推荐(0)
摘要:代码: #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vector> #include <set> #include <stack> #include <queue> #inc 阅读全文
posted @ 2018-02-07 22:03 TQCAI 阅读(295) 评论(0) 推荐(0)
摘要:1.最长公共子序列 参考博客: http://blog.csdn.net/hrn1216/article/details/51534607 http://blog.csdn.net/u013074465/article/details/45392687 代码: #include <stdio.h> 阅读全文
posted @ 2018-02-07 18:03 TQCAI 阅读(229) 评论(0) 推荐(0)
摘要:1.P1060 开心的金明 https://www.luogu.org/problemnew/solution/P1164 #include <stdio.h> #include <memory.h> #include <math.h> #include <string> #include <vec 阅读全文
posted @ 2018-02-05 21:16 TQCAI 阅读(211) 评论(0) 推荐(0)
摘要:公共部分 定义了高精度数据结构“hp”,并且定义了输入(构造函数),输出(print),以及初始化(默认构造函数),隐藏了部分细节。 并且hp内部存储的数据是真实数据的逆序,但是在输入和输出的时候自动换序 高精度乘高精度 代码: 代码理解: 这是一段相当精简的代码,非常有利于程序员记忆。我昨天还在学 阅读全文
posted @ 2018-02-03 21:26 TQCAI 阅读(716) 评论(0) 推荐(0)