欢迎访问我的个人网站==》 jiashubing.cn
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 40 下一页
摘要: 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 贾树丙 阅读(641) 评论(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 贾树丙 阅读(285) 评论(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 贾树丙 阅读(273) 评论(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 贾树丙 阅读(337) 评论(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 贾树丙 阅读(641) 评论(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 贾树丙 阅读(191) 评论(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 贾树丙 阅读(232) 评论(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 贾树丙 阅读(326) 评论(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 贾树丙 阅读(280) 评论(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 贾树丙 阅读(347) 评论(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 贾树丙 阅读(466) 评论(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 贾树丙 阅读(258) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1114题目大意:根据储钱罐的重量,求出里面钱最少有多少。给定储钱罐的初始重量,装硬币后重量,和每个对应面值硬币的重量。Sample Input310 11021 130 5010 11021 150 301 6210 320 4Sample OutputThe minimum amount of money in the piggy-bank is 60.The minimum amount of money in the piggy-bank is 100.This is impossible.分 阅读全文
posted @ 2013-08-24 21:39 贾树丙 阅读(361) 评论(0) 推荐(0)
摘要: 1. 为何状态压缩: 棋盘规模为n*m,且m≤10,如果用一个int表示一行上棋子的状态,足以表示m≤10所要求的范围。故想到用int s[num]。至于开多大的数组,可以自己用DFS搜索试试看;也可以遍历0~2^m-1,对每个数值的二进制表示进行检查;也可以用数学方法(?)2. 如何构造状态: 当然,在此之前首先要想到用DP(?)。之后,才考虑去构造状态函数f(...)。 这里有一个链式的限制:某行上的某个棋子的攻击范围是2。即,第r行的状态s[i],决定第r-1行只能取部分状态s[p];同时,第r行的状态s[i],第r-1行状态s[p],共同决定第r-2行只能取更少的状态s[q]。当然,最 阅读全文
posted @ 2013-08-24 03:55 贾树丙 阅读(282) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1074题目大意:学生要完成各科作业, 给出各科老师给出交作业的期限和学生完成该科所需时间, 如果逾期一天则扣掉一单位学分, 要你求出完成所有作业而被扣最小的学分, 并将完成作业的顺序输出.Sample Input23Computer 3 3English 20 1Math 3 23Computer 3 3English 6 3Math 6 3Sample Output2ComputerMathEnglish3ComputerEnglishMath分析:(转)刚开始以为是背包, 但背包难以记录输出顺序 阅读全文
posted @ 2013-08-24 03:47 贾树丙 阅读(297) 评论(0) 推荐(0)
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 40 下一页