11 2011 档案

HDU 1850 Being a Good Boy in Spring Festival (博弈)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1850用到的知识:(三)尼姆博奕(Nimm Game):有三堆各若干个物品,两个人轮流从某一堆取任意多的物品,规定每次至少取一个,多者不限,最后取光者得胜。 这种情况最有意思,它与二进制有密切关系,我们用(a,b,c)表示某种局势,首先(0,0,0)显然是奇异局势,无论谁面对奇异局势,都必然失败。第二种奇异局势是(0,n,n),只要与对手拿走一样多的物品,最后都将导致(0,0,0)。仔细分析一下,(1,2,3)也是奇异局势,无论对手如何拿,接下来都可以变为(0,n,n)的情形。 计算机算法里面有.. 阅读全文

posted @ 2011-11-24 22:53 kuangbin 阅读(1646) 评论(0) 推荐(0)

HDU 2149 Public Sale (博弈)
摘要:Public SaleTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1148Accepted Submission(s): 701Problem Description虽然不想,但是现实总归是现实,Lele始终没有逃过退学的命运,因为他没有拿到奖学金。现在等待他的,就是像FarmJohn一样的农田生涯。要种田得有田才行,Lele听说街上正在举行一场别开生面的拍卖会,拍卖的物品正好就是一块20亩的田地。于是,Lele带上他的全部积蓄,冲往拍卖会 阅读全文

posted @ 2011-11-24 22:08 kuangbin 阅读(671) 评论(0) 推荐(0)

HDU 1080 Human Gene Functions (DP) by kuangbin
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1080#include<stdio.h>#include<algorithm>using namespace std;int dp[110][110];int Maxtri[5][5]={ {0,-3,-4,-2,-1}, {-3,5,-1,-2,-1}, {-4,-1,5,-3,-2}, {-2,-2,-3,5,-2}, {-1,-1,-2,-2,5}}; int num1[110];int num2[110];int main(){ // freop... 阅读全文

posted @ 2011-11-24 21:07 kuangbin 阅读(388) 评论(0) 推荐(0)

HDU 1082 Matrix Chain Multiplication by kuangbin
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1082writed by kuangbin题目大意:大意就是给你n个矩阵,再给你一个矩阵链,先判断矩阵链是否合法,再计算这个矩阵链要做多少次乘法。代码:#include<stdio.h>#include<string.h>int a[26][2];int zhan[1000][2];int top;int sum;char str[1000];int jin(int x){ zhan[top][0]=a[x][0]; zhan[top][1]=a[x][1]; top++; 阅读全文

posted @ 2011-11-24 19:18 kuangbin 阅读(741) 评论(0) 推荐(0)

HDU 1081 To The Max (DP) 扩展最大子列和,求最大子矩阵和
摘要:To The MaxTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3768Accepted Submission(s): 1798Problem DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1 x 1 or greater locat 阅读全文

posted @ 2011-11-24 14:16 kuangbin 阅读(685) 评论(0) 推荐(0)

2011 ACM 福州赛区现场赛第一题 (A .Xiangqi)HDU 4121 Xiangqi by kuangbin
摘要:Xiangqi HDU4121 阅读全文

posted @ 2011-11-23 19:45 kuangbin 阅读(1869) 评论(3) 推荐(2)

POJ数学题目
摘要:转:http://blog.sina.com.cn/s/blog_6635898a0100magq.html1.burnside定理,polya计数法 这个大家可以看brudildi的《组合数学》,那本书的这一章写的很详细也很容易理解。最好能完全看懂了,理解了再去做题,不要只记个公式。 *简单题:(直接用套公式就可以了) pku2409 Let it Beadhttp://acm.pku.edu.cn/JudgeOnline/problem?id=2409 pku2154 Colorhttp://acm.pku.edu.cn/JudgeOnline/problem?id=2154 pku128 阅读全文

posted @ 2011-11-17 01:44 kuangbin 阅读(1731) 评论(0) 推荐(0)

菜鸟,大牛,教主的区别
摘要:对菜鸟来说题目有三种:会算法且能AC的,会算法但不能AC的,不会做的对大牛来说题目有两种:会做的,不会做的对教主来说题目有两种:能AC的,数据有错的菜鸟提交WA了,找了N久找不出错时,在论坛大骂数据有错,但是没人理大牛提交WA了,找了N久找不出错时,写暴力程序或者求别人的AC程序对拍教主提交WA了,Judge马上修正数据菜鸟面对一道难题,直接暴搜大牛面对一道难题,算了算时间复杂度不对,或者证明出是NP难,果断放弃教主面对一道难题,说,虽然我不会做,但AC还是没有问题的菜鸟AC了一道难题,巴不得召告天下大牛AC了一道难题,会写一篇解题报告,第一句话一定是:这题其实不难教主AC了一道难题,好像什么 阅读全文

posted @ 2011-11-17 01:42 kuangbin 阅读(4876) 评论(15) 推荐(12)

背包问题教程-01背包,完全背包,多重背包,混合背包 收藏
摘要:P01: 01背包问题题目有N件物品和一个容量为V的背包。第i件物品的费用是c[i],价值是w[i]。求解将哪些物品装入背包可使价值总和最大。基本思路这是最基础的背包问题,特点是:每种物品仅有一件,可以选择放或不放。用子问题定义状态:即f[i][v]表示前i件物品恰放入一个容量为v的背包可以获得的最大价值。则其状态转移方程便是:f[i][v]=max{f[i-1][v],f[i-1][v-c[i]]+w[i]}这个方程非常重要,基本上所有跟背包相关的问题的方程都是由它衍生出来的。所以有必要将它详细解释一下:“将前i件物品放入容量为v的背包中”这个子问题,若只考虑第i件物品的策略(放或不放),那 阅读全文

posted @ 2011-11-16 02:30 kuangbin 阅读(2530) 评论(0) 推荐(0)

ZOJ 1104 Leaps Tall Buildings by kuangbin
摘要:Leaps Tall BuildingsTime Limit: 2 Seconds Memory Limit: 65536 KB Special JudgeIt's a bird! It's a plane! It's coming right at us!Although it sometimes seems like it, Superman can't fly (without a plane). Instead, he makes super-human leaps, especially over tall buildings. Since he ne 阅读全文

posted @ 2011-11-15 22:49 kuangbin 阅读(651) 评论(0) 推荐(0)

ZOJ 1081 Points Within
摘要:Points WithinTime Limit: 2 Seconds Memory Limit: 65536 KBStatement of the Problem Several drawing applications allow us to draw polygons and almost all of them allow us to fill them with some color. The task of filling a polygon reduces to knowing which points are inside it, so programmers have to . 阅读全文

posted @ 2011-11-15 18:28 kuangbin 阅读(434) 评论(0) 推荐(0)

HDU 2131 Probability(水题) by kuangbin
摘要:ProbabilityTime Limit: 3000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2313Accepted Submission(s): 1146Problem DescriptionMickey is interested in probability recently. One day , he played a game which is about probability with mini.First mickey gives a letter 阅读全文

posted @ 2011-11-15 03:13 kuangbin 阅读(427) 评论(0) 推荐(0)

POJ 3605 Sheryl's Circuit I
摘要:/*题意:就是给你一个有2^n个输入的门电路,初始输入为全0,问至少要改变输入开关多少次(即改变输入中0、1多少次)才能得到所需的0、1输出序列。题意分析:这道题的数据范围为k<10000,所以不能枚举暴搞,只能用递推来求解。仔细分析就可一发现当有多个0或多个1在一起时,是不用改变开关的。只有在输出序列中出现0到1或1到0的跳变时才需要改变开关。*/#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int ch[10010];char str[10010] 阅读全文

posted @ 2011-11-14 18:17 kuangbin 阅读(405) 评论(0) 推荐(0)

FOJ 1021 飞船赛 (水题)
摘要:Problem 1021 飞船赛Accept: 1368Submit: 5167Time Limit: 1000 mSecMemory Limit : 32768 KB Problem Description有N个飞船进行比赛,它们的跑道为直线并互相平行。每个飞船的起跑位置均不相同。第i个飞船从起跑线右边Xi处开始向右行驶(Xi各不相同)。比赛开始后,它能在零时间内加速到最大速度Vi并永远保持此速度。比赛没有终点,即会永远进行下去。你的任务是算出比赛过程中一共有多少次"超车"。 Input输入数据由多组数据组成。每组数据格式如下:第一行为一个整数N(1<=N<= 阅读全文

posted @ 2011-11-14 12:34 kuangbin 阅读(996) 评论(0) 推荐(0)

POJ 1192 最优连通子集(树形DP)
摘要:最优连通子集Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 1649Accepted: 855Description众所周知,我们可以通过直角坐标系把平面上的任何一个点P用一个有序数对(x, y)来唯一表示,如果x, y都是整数,我们就把点P称为整点,否则点P称为非整点。我们把平面上所有整点构成的集合记为W。 定义1 两个整点P1(x1, y1), P2(x2, y2),若|x1-x2| + |y1-y2| = 1,则称P1, P2相邻,记作P1~P2,否则称P1, P2不相邻。 定义 2 设点集S是W的一个有限子集,即S = 阅读全文

posted @ 2011-11-13 12:39 kuangbin 阅读(637) 评论(1) 推荐(0)

HDU 4112Break the Chocolate(2011ACM成都赛区)
摘要:Break the ChocolateTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 427Accepted Submission(s): 142Problem DescriptionBenjamin is going to host a party for his big promotion coming up.Every party needs candies, chocolates and beer, and of course Benj 阅读全文

posted @ 2011-11-12 16:44 kuangbin 阅读(1070) 评论(2) 推荐(0)

POJ1485 Fast Food(DP)
摘要:Fast FoodTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 1597Accepted: 553Special JudgeDescriptionThe fastfood chain McBurger owns several restaurants along a highway. Recently, they have decided to build several depots along the highway, each one located at a restaurant and supplying sever 阅读全文

posted @ 2011-11-12 14:18 kuangbin 阅读(1612) 评论(1) 推荐(0)

POJ 1013 Counterfeit Dollar(枚举)
摘要:Counterfeit DollarTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 30917Accepted: 9680DescriptionSally Jones has a dozen Voyageur silver dollars. However, only eleven of the coins are true silver dollars; one coin is counterfeit even though its color and size make it indistinguishable from t 阅读全文

posted @ 2011-11-12 12:52 kuangbin 阅读(602) 评论(0) 推荐(0)

HDU 4091 Zombie’s Treasure Chest(2011ACM上海赛区预选赛第一题)
摘要:Zombie’s Treasure ChestTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 994Accepted Submission(s): 211Problem DescriptionSome brave warriors come to a lost village. They are very lucky and find a lot of treasures and a big treasure chest, but with a 阅读全文

posted @ 2011-11-07 18:50 kuangbin 阅读(1026) 评论(0) 推荐(0)

HDU1084 What Is Your Grade?(水题,简单)
摘要:What Is Your Grade?Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4032Accepted Submission(s): 1198Problem Description“Point, point, life of student!”This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. H 阅读全文

posted @ 2011-11-01 17:32 kuangbin 阅读(2779) 评论(0) 推荐(0)

HDU 1086 You can Solve a Geometry Problem too(水题,判断线段相交)
摘要:You can Solve a Geometry Problem tooTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3077Accepted Submission(s): 1452Problem DescriptionMany geometry(几何)problems were designed in the ACM/ICPC. And now, I also prepare a geometry problem for this fina 阅读全文

posted @ 2011-11-01 01:12 kuangbin 阅读(1776) 评论(0) 推荐(0)

HDU 1088 Write a simple HTML Browser(水题)
摘要:Write a simple HTML BrowserTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3398Accepted Submission(s): 890Problem DescriptionIf you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed. Now, who can 阅读全文

posted @ 2011-11-01 00:50 kuangbin 阅读(2099) 评论(0) 推荐(0)

导航

JAVASCRIPT: