05 2014 档案
摘要:Problem Description度度熊是一只喜欢探险的熊,一次偶然落进了一个m*n矩阵的迷宫,该迷宫只能从矩阵左上角第一个方格开始走,只有走到右上角的第一个格子才算走出迷宫,每一次只能走一格,且只能向上向下向右走以前没有走过的格子,每一个格子中都有一些金币(或正或负,有可能遇到强盗拦路抢劫,度...
阅读全文
摘要:LCS问题就是求两个字符串最长公共子串的问题。解法就是用一个矩阵来记录两个字符串中所有位置的两个字符之间的匹配情况,若是匹配则为1,否则为0。然后求出对角线最长的1序列,其对应的位置就是最长匹配子串的位置。下面是字符串21232523311324和字符串312123223445的匹配矩阵,前者为X方...
阅读全文
摘要:题目:Problem DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1 x 1 or gr...
阅读全文
摘要:一道记忆搜索题,记忆搜索题就是搜索的形式+DP的思想!题目:FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid locatio...
阅读全文
摘要:七种qsort排序方法一、对int类型数组排序intnum[100];Sample:intcmp(constvoid*a,constvoid*b){return*(int*)a-*(int*)b;}qsort(num,100,sizeof(num[0]),cmp);二、对char类型数组排序(同in...
阅读全文
摘要:题目:The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms e...
阅读全文
摘要:二维的数组,比如i,j相加是偶数,目标相加是偶数,则只能经过偶数步,如果所给是奇数步,自然就无需再算,肯定不成功。
阅读全文
摘要:题目:The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie coul...
阅读全文
摘要:1 for(j = 1; j 0){6 value[cout ++] = num * value1[i];7 }View Code如num = 4, 将其优化成1 2,这样4以内的数都可以用1 2组合表示。
阅读全文
摘要:题目:We all know that Bin-Laden is a notorious terrorist, and he has disappeared for a long time. But recently, it is reported that he hides in Hang Zho...
阅读全文
摘要:题目:不死族的巫妖王发工资拉,死亡骑士拿到一张N元的钞票(记住,只有一张钞票),为了防止自己在战斗中频繁的死掉,他决定给自己买一些道具,于是他来到了地精商店前.死亡骑士:"我要买道具!"地精商人:"我们这里有三种道具,血瓶150块一个,魔法药200块一个,无敌药水350块一个."死亡骑士:"好的,给...
阅读全文
摘要:题目:Problem DescriptionNowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don't know that Computer College ha...
阅读全文
摘要:题目:电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡...
阅读全文
摘要:1题目:给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 2 3 int main(){ 4 int n, a[10001], left, beforeleft, right, i, max, sum;...
阅读全文
摘要:1题目:Problem Description搬寝室是很累的,xhd深有体会.时间追述2006年7月9号,那天xhd迫于无奈要从27号楼搬到3号楼,因为10号要封楼了.看着寝室里的n件物品,xhd开始发呆,因为n是一个小于2000的整数,实在是太多了,于是xhd决定随便搬2*k件过去就行了.但还是会...
阅读全文
摘要:题目Problem DescriptionA group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building,...
阅读全文

浙公网安备 33010602011771号