04 2009 档案

ZJU 1642 Match for Bonus
摘要:分析:好邪恶的一题,是典型的LCS变形,数据规模没有给出,但却很大。直接开2维会超空间,要用滚动数组。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.c... 阅读全文

posted @ 2009-04-30 19:20 黄浩贤 阅读(172) 评论(0) 推荐(0)

PKU 2234 Matches Game
摘要:分析:简单的博弈论。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#includeiostream> usingnamespacestd... 阅读全文

posted @ 2009-04-30 14:20 黄浩贤 阅读(176) 评论(0) 推荐(0)

PKU 1979 Red and Black
摘要:分析:挺简单的搜索,用DFS的时候把搜到的点置1,然后统计一下就行了。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#includeio... 阅读全文

posted @ 2009-04-30 14:19 黄浩贤 阅读(236) 评论(0) 推荐(0)

PKU 1163 The Triangle
摘要:分析:经典DP,从上往下递归,从下往上求解。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#includeiostream> using... 阅读全文

posted @ 2009-04-30 14:17 黄浩贤 阅读(158) 评论(0) 推荐(0)

PKU 2085 Inversion
摘要:分析:读题比做题难~ ~!!,要找规律,给出一个有帮助的数列,0 1 3 6 10 15 21 28 ...... Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighli... 阅读全文

posted @ 2009-04-30 14:15 黄浩贤 阅读(217) 评论(0) 推荐(0)

PKU 1730 Perfect Pth Powers
摘要:分析:要灵活变通。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#includeiostream> #includecmath> us... 阅读全文

posted @ 2009-04-30 14:12 黄浩贤 阅读(153) 评论(0) 推荐(0)

PKU 1281 MANAGER
摘要:没什么好分析,只要弄懂题意就行了。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#includeiostream> #included... 阅读全文

posted @ 2009-04-30 14:10 黄浩贤 阅读(253) 评论(0) 推荐(0)

PKU 1067 取石子游戏
摘要:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#includeiostream> #includealgorithm> #includecmath> ... 阅读全文

posted @ 2009-04-29 16:54 黄浩贤 阅读(266) 评论(0) 推荐(0)

取石子问题
摘要:取石子问题 有一种很有意思的游戏,就是有物体若干堆,可以是火柴棍或是围棋子等等均可。两个人轮流从堆中取物体若干,规定最后取光物体者取胜。这是我国民间很古老的一个游戏,别看这游戏极其简单,却蕴含着深刻的数学原理。下面我们来分析一下要如何才能够取胜。 (一)巴什博奕(Bash Game)... 阅读全文

posted @ 2009-04-29 16:36 黄浩贤 阅读(409) 评论(1) 推荐(0)

PKU 1423 Big Number
摘要:分析:利用数论中的近似公式。 n!=sqrt(2*pi*n)*((n/e)^n)*(1+1/(12*n)+1/(288*n*n)+o(1/n^3)) 位数约等于 log10(n!)=log10(2*pi*n)+n*log10(n/e) log10(1+1/(12*n)+1/(288*n*n)+o(1... 阅读全文

posted @ 2009-04-29 12:21 黄浩贤 阅读(230) 评论(0) 推荐(0)

PKU 1730 Perfect Pth Powers
摘要:分析: 简单的枚举。从log2(x)到1计算一次是否存x=b^p。但题目有点问题,说了从2到2^32次方却存在负数。 Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighte... 阅读全文

posted @ 2009-04-29 11:28 黄浩贤 阅读(337) 评论(0) 推荐(0)

HDU 1034 Candy Sharing Game
摘要:直接模拟。 用qsort排序后,当第一个学生和最后一个学生的糖果数相等时,结束游戏。 Code Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->#in... 阅读全文

posted @ 2009-04-28 16:03 黄浩贤 阅读(197) 评论(0) 推荐(0)

HDU 1850 Being a Good Boy in Spring Festival
摘要:分析: 首先假设先手的人有必赢策略。 问题则转化为=>在任意一堆拿任意K张牌,并且所有堆的nim-sum=0(P-position)的方案总数。 现在我们先看一个例子(5,7,9),并假设从第一堆取任意K张牌。 排除第一堆牌的nim-sum为 7^9=14 0111 ^1001 ------- ... 阅读全文

posted @ 2009-04-28 13:46 黄浩贤 阅读(561) 评论(0) 推荐(0)

博弈论(二):Sprague-Grundy函数
摘要:上一期的文章里我们仔细研究了Nim游戏,并且了解了找出必胜策略的方法。但如果把Nim的规则略加改变,你还能很快找出必胜策略吗?比如说:有n堆石子,每次可以从第1堆石子里取1颗、2颗或3颗,可以从第2堆石子里取奇数颗,可以从第3堆及以后石子里取任意颗……这时看上去问题复杂了很多,但相信你如果掌握了本节... 阅读全文

posted @ 2009-04-28 12:00 黄浩贤 阅读(400) 评论(0) 推荐(0)

博弈论(一):Nim游戏
摘要:从今天开始,我将会用一系列文章介绍博弈论(Game Theory)的基本知识,以OI中可能用得着的为主。当然,我对博弈论的理解还很肤浅,而且我写东西的风格向来都是“个人心得”而非“传道授业”的类型。所以若你想仔细学习博弈论,我强烈推荐加利福尼亚大学的Thomas S. Ferguson教授精心撰写并... 阅读全文

posted @ 2009-04-28 12:00 黄浩贤 阅读(1101) 评论(0) 推荐(0)