欢迎访问我的个人网站==》 jiashubing.cn
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 39 下一页
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3442题目大意:三国时期,刘备逃亡。给定一个最大为50*50的地图,刘备在地图中只能往4个方向走。 地图中,A代表瞭望塔,攻击范围是2,攻击伤害是1; B 代表堡垒,攻击范围是3,攻击伤害是2; C 代表火焰,对于走在该位置上的单位造成3点伤害; D 代表弓箭手,攻击范围是2,攻击伤害是4; E 代表士兵,攻击范围是1,攻击伤害是5; $ 代表刘备; !代表目的地; # 代表障碍物 . 代表地板刘备不能穿过A,B,D,E。但是可以走上C和地板。 有3条重要规则:1.刘备不能被相同的... 阅读全文
posted @ 2013-08-31 23:14 贾树丙 阅读(368) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2809题目大意:给出战神吕布的初始攻击力ATI、防御力DEF、生命值HP、每升一级增加的攻击力In_ATI,增加的防御力In_DEF和增加的生命值In_HP。然后给出n个敌人的攻击力、防御力、生命值和杀死该单位能获得的经验值EXP。 吕布的初始经验值EXP是0,初始等级level是1,每当EXP>=level*100时就会升级。 在吕布LvBu和敌人A之间的战斗有3条规则 1.吕布攻击A,A失去Max(1,LvBu's ATI- A's DEF) HP; 2.A攻击吕布,吕布失 阅读全文
posted @ 2013-08-30 21:47 贾树丙 阅读(528) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3311题目大意:一个送披萨的,每次送外卖不超过10个地方,给你这些地方之间的时间,求送完外卖回到店里的总时间最小。Sample Input30 1 10 101 0 1 210 1 0 1010 2 10 00Sample Output8分析:dp[i][j]:表示在i状态(用二进制表示城市有没有经过)时最后到达j城市的最小时间,转移方程:dp[i][j]=min(dp[i][k]+d[k][j],dp[i][j]) d[k][j]是k城市到j城市的最短距离,显然要先用flody处理一下。代码如下: 1 # include 2 # 阅读全文
posted @ 2013-08-29 21:58 贾树丙 阅读(378) 评论(0) 推荐(0) 编辑
摘要: Mondriaan's DreamProblem DescriptionSquares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw on, for all of his paper was filled with squares and rectangles), he 阅读全文
posted @ 2013-08-29 19:07 贾树丙 阅读(626) 评论(0) 推荐(0) 编辑
摘要: 使用Pascal的OIers简要介绍一下C/C++样式的位运算(bitwise operation)。其优先级:not>and>xor>or 使用Pascal的OIers简要介绍一下C/C++样式的位运算(bitwise operation)。其优先级:not>and>xor>or 名称 C/C++ 阅读全文
posted @ 2013-08-29 18:11 贾树丙 阅读(273) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4257题目大意:有 n(2 2 # include 3 const int N = (1<<10); 4 int A[11][11],dp[N]; 5 6 int main(){ 7 int n,i,j; 8 while(scanf("%d",&n) && n){ 9 for(i=0; i<n; i++)10 for(j=0; j<n; j++)11 scanf("%d",&am 阅读全文
posted @ 2013-08-28 17:56 贾树丙 阅读(269) 评论(0) 推荐(0) 编辑
摘要: To and FroDescriptionMo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message (letters only) down the columns, padding with extra random letters so as to make a rectangular array of letters. For example, if the message is " 阅读全文
posted @ 2013-08-28 04:23 贾树丙 阅读(328) 评论(0) 推荐(0) 编辑
摘要: Headmaster's Headachehe headmaster of Spring Field School is considering employing some new teachers for certain subjects. There are a number of teachers applying for the posts. Each teacher is able to teach one or more subjects. The headmaster wants to select applicants so that each subject is 阅读全文
posted @ 2013-08-28 03:58 贾树丙 阅读(633) 评论(1) 推荐(0) 编辑
摘要: 主题曲 Let's Fly Now Let's Try NowLet's Fly Now Get My StrengthLet's Try Now Let's My StrengthLet's Fly Now Get My StrengthLet's Try Now!攀上心灵雀跃的舞台 立于正中央试 阅读全文
posted @ 2013-08-28 01:35 贾树丙 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=1564题目大意:给定一个整数t,和n个元素组成的集合。求能否用该集合中的元素和表示该整数,如果可以输出所有可行解。1 2 # include 3 # include 4 using namespace std; 5 bool cmp(int a,int b){ 6 return a>b; 7 } 8 int a[15],t,n; 9 bool flag;10 int ans[15],len;11 12 void dfs(int sum,int mark){13 int i;14 if(sum == 0){1... 阅读全文
posted @ 2013-08-27 21:50 贾树丙 阅读(228) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3006题目大意:给定n个集合,每个集合都是由大于等于1小于等于m的数字组成,m最大为14。由给出的集合可以组成多少个不同的集合。输入描述:第一行为n,m,接下来n行,每行包含k+1个数字,第一个为k,表示该集合的元素个数,接下来k行表示集合元素。Sample Input4 41 11 21 31 42 43 1 2 34 1 2 3 4Sample Output152分析:以为m的规模很小,可以用二进制表示集合。借助位运算的或( | )来达到集合合并的目的。 比如一个集合中有两个元素 1 3 那就. 阅读全文
posted @ 2013-08-26 19:11 贾树丙 阅读(311) 评论(0) 推荐(0) 编辑
摘要: All in All题目链接:http://poj.org/problem?id=1936题目大意:判断从字符串s2中能否找到子串s1。字符串长度为10W。Sample Inputsequence subsequenceperson compressionVERDI vivaVittorioEmanueleReDiItaliacaseDoesMatter CaseDoesMatterSample OutputYesNoYesNo分析:这明明是模拟题,有人竟然把它归为动态规划,是要用LCS做吗代码如下: 1 # include 2 # include 3 # define MAX 100005 阅读全文
posted @ 2013-08-26 02:33 贾树丙 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 滑雪DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9一个人可以从某个点滑向上下左右相邻四个点之一,当且仅当高度减小。在上面的例子中,一条可滑行的滑坡为24-17-16-1。当然25-24-23-...-3-2-1更长。事实上,这是... 阅读全文
posted @ 2013-08-26 02:11 贾树丙 阅读(343) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3280题目大意:给定一个字符串,可以删除增加,每个操作都有代价,求出将字符串转换成回文串的最小代价Sample Input3 4abcba 1000 1100b 350 700c 200 800Sample Output900分析:这是一道最长回文串的变形,就是LCS 一串字符要变成回文,对于一个字符来说,删掉它,或者增加对称的一个该字符,都能达到回文的效果,所以是等价的。所以取代价的的时候选择最小的就可以。 至于动态规划方程:令dp[i][j]表示从第 i 个字符到第j个字符变成回文的最小代价,初始为0。接着LCSdp[i].. 阅读全文
posted @ 2013-08-24 22:18 贾树丙 阅读(462) 评论(2) 推荐(0) 编辑
摘要: 题目链接:http://poj.org/problem?id=3181题目大意:用1,2...K元的硬币,凑成N元的方案数。Sample Input5 3Sample Output5分析:这不是母函数是什么,不管你信不信,反正我是信了。 之前有过一篇,讲母函数的动态规划做法http://www.cnblogs.com/acm-bingzi/archive/2013/04/30/3051725.html 这道题目,坑就坑在高精度上了,刚开始怎么也没想到,而且做法也很奇特。就是将2个long long 的数字进行拼接。代码如下: 1 # include 2 # include 3 # defi.. 阅读全文
posted @ 2013-08-24 22:00 贾树丙 阅读(246) 评论(0) 推荐(0) 编辑
上一页 1 ··· 27 28 29 30 31 32 33 34 35 ··· 39 下一页