上一页 1 ··· 3 4 5 6 7 8 下一页
摘要: 先上题目Sum of Factorials Time Limit:500MS Memory Limit:32768KB 64bit IO Format:%lld & %lluDescriptionGiven an integer n, you have to find whether it can be expressed as summation of factorials. For given n, you have to report a solution such thatn = x1! + x2! + ... + xn! (xi 2 #inclu... 阅读全文
posted @ 2013-07-28 19:52 海拉鲁的林克 阅读(498) 评论(0) 推荐(0) 编辑
摘要: 先上题目Problem FPLAYING BOGGLEBoggle® is a classic word game played on a 4 by 4 grid of letters. The letter grid is randomly generated by shaking 16 cubes labeled with a distribution of letters similar to that found in English words. Players try to find words hidden within the grid.Words are forme 阅读全文
posted @ 2013-07-28 19:32 海拉鲁的林克 阅读(916) 评论(0) 推荐(0) 编辑
摘要: 先上题目Color the ballTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5650Accepted Submission(s): 3009Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a 2 #include 3 #define MAX (100000+10) 4 using namespace std; 5 6 typedef struct 7 { 8 ... 阅读全文
posted @ 2013-07-24 22:44 海拉鲁的林克 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 先上题目还是畅通工程Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 19536Accepted Submission(s): 8687Problem Description某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。Input测试输入包含若干测试用例。每 阅读全文
posted @ 2013-07-24 20:19 海拉鲁的林克 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 先上题目Balanced LineupTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 28206Accepted: 13220Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with 阅读全文
posted @ 2013-07-23 21:14 海拉鲁的林克 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 上题目:296. Sasha vs. KateTime limit per test: 1 second(s)Memory limit: 65536 kilobytesinput: standardoutput: standardDuring the regular Mars's World Finals Subregional Programming Contest a boy Sasha lost N "Mars" bars of chocolate to a girl Kate. But for two years already Sasha does not 阅读全文
posted @ 2013-07-20 23:18 海拉鲁的林克 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 上题目Moving TablesTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14754Accepted Submission(s): 5039Problem DescriptionThe famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor 阅读全文
posted @ 2013-07-20 22:45 海拉鲁的林克 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 上题目:Fire NetTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4734Accepted Submission(s): 2684Problem DescriptionSuppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing 阅读全文
posted @ 2013-07-20 22:24 海拉鲁的林克 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 这东西暂时只看懂了贪心算法的一点,先收藏起来,认识更多的时候再看来源:http://hi.baidu.com/winterlegend/item/dc752c0bf2c18c8c02ce1bad贪心算法与拟阵基础贪心算法是通过一系列的选择来得到问题的最优解。对于每一个决策点,贪心算法所做出的都是当前状态下的最优决策。贪心算法的设计,一般为:1)将优化问题转化为这样的问题,即先做出决策,再解决剩下的一个子问题。2)证明原问题总是有一个最优解是通过贪心得到的,从而说明贪心策略的安全性。(注意这里证明的技巧,是“总是有一个”)3)说明在做出贪心选择后,剩余的子问题具有这样的一个性质:即如果将子问题的 阅读全文
posted @ 2013-07-20 21:58 海拉鲁的林克 阅读(1428) 评论(0) 推荐(0) 编辑
摘要: 上题目Doing Homework againTime Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4429Accepted Submission(s): 2595Problem DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadl 阅读全文
posted @ 2013-07-20 21:32 海拉鲁的林克 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 上题目FatMouse' TradeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 33316Accepted Submission(s): 10813Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, Jav 阅读全文
posted @ 2013-07-20 21:03 海拉鲁的林克 阅读(182) 评论(0) 推荐(0) 编辑
摘要: 上题目Walls ime Limit:1500MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uDescriptionPeople of country T-land lived on the big plain many years ago. It is happened so that they started to quarrel, so they began to build walls to separate from each other. One day they realized that walls surrou 阅读全文
posted @ 2013-07-17 23:26 海拉鲁的林克 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 上题目RewardTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2522Accepted Submission(s): 745Problem DescriptionDandelion's uncle is a boss of a factory. As the spring festival is coming , he wants to distribute rewards to his workers. Now he has a 阅读全文
posted @ 2013-07-15 21:27 海拉鲁的林克 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 先上题目确定比赛名次Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 7800Accepted Submission(s): 3014Problem Description有N个比赛队(1 2 #include 3 #include 4 #define MAX 550 5 using namespace std; 6 7 int s[MAX][MAX]; 8 9 10 struct cmp11 {12 bool operator(... 阅读全文
posted @ 2013-07-15 18:49 海拉鲁的林克 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 上题目:最短路Time Limit: 5000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 21107Accepted Submission(s): 8998Problem Description在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N 2 #in 阅读全文
posted @ 2013-07-15 14:47 海拉鲁的林克 阅读(236) 评论(0) 推荐(0) 编辑
摘要: 先上题目 The order of a TreeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 830Accepted Submission(s): 448Problem DescriptionAs we know,the shape of a binary search tree is greatly related to the order of keys we insert. To be precisely:1.insert a key. 阅读全文
posted @ 2013-07-14 17:29 海拉鲁的林克 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 先上题目Problem AChess Queen Input: Standard InputOutput: StandardOutput You probably know how the game ofchess is played and how chess queen operates. Two chess queens are in attackingposition when they are on same row, column or diagonal of a chess board.Suppose two such chess queens (one black and th 阅读全文
posted @ 2013-07-11 21:35 海拉鲁的林克 阅读(401) 评论(0) 推荐(0) 编辑
摘要: 先上问题Problem DescriptionHDU ACM集训队的队员在暑假集训时经常要讨论自己在做题中遇到的问题.每当面临自己解决不了的问题时,他们就会围坐在一张圆形的桌子旁进行交流,经过大家的 讨论后一般没有解决不了的问题,这也只有HDU ACM集训队特有的圆桌会议,有一天你也可以进来体会一下哦:),在一天在讨论的时候,Eddy想出了一个极为古怪的想法,如果他们在每一分钟内,一对相 邻的两个ACM队员交换一下位子,那么要多少时间才能得到与原始状态相反的座位顺序呢?(即对于每个队员,原先在他左面的队员后来在他右面,原先在他右面 的队员在他左面),这当然难不倒其他的聪明的其他队友们,马上就把 阅读全文
posted @ 2013-07-04 16:33 海拉鲁的林克 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 因为考试所以最近都没有做什么题。想不到这题都卡(~~~~(>_2->4···这样变化,后来还是不得不上网看了一下题解,发现只需要判断1有没有回到一开始的位置就可以了,1的变化就是一开始是1->2->4```这样变化,但是当去到后面到达不了2的n次幂的情况下,就要按照题目的方法把1放回到前面,位置在(i-n)*2-1,其中i是1的当前位置,n是输入的n,i要大于n且i*2也要大于2*n才执行这一步。上代码 1 #include 2 #include 3 #include 4 #define MAX 10000 5 6 using namesp 阅读全文
posted @ 2013-07-03 15:42 海拉鲁的林克 阅读(232) 评论(0) 推荐(0) 编辑
摘要: 出处:http://hi.baidu.com/song_renchu/item/cba7b32997034a0c43634ac4最大子图形问题详解宋壬初最大子图形问题包括最大子正方形、最大子矩形、最大子三角形、最大子菱形等。这些问题可以用动态规划来解决。通过最大子图形问题,我们充分掌握了动态规划的核心思想,即同一的子问题只算一次。同时培养了对于图形的敏锐的观察力。子问题1:连续的1给定一个01串,求其中最长的连续1子串的长度。比如,对于串00101110110,最长连续1子串的长度是3。它由第5到7个字符组成。怎么解决呢?我们用一个数组a[1..n]来记录这个01串,然后,我们用一个数组f[0 阅读全文
posted @ 2013-06-12 19:11 海拉鲁的林克 阅读(466) 评论(0) 推荐(0) 编辑
摘要: 先上题目 输入一个n表示有一个n*n的矩阵,然后输入矩阵的内容,"H"代表0,"."代表1,求出最大的填满1的正方形的面积。 这是一道dp。 定义一个数组s[][]代表以(1,1)和(i,j)为对角线的矩形中全为1的的矩形的边长。 再定义一个数组row[][]代表(i,0)-(i,j)连续的1最长的长度; 再定义一个数组col[][]代表(0,j)-(i,j)连续的1最长的长度; 则 if((i,j)==0) row[i][j]=col[i][j]=0; else { row[i][j]=row[i][j-1]+1; col[i][j]=col[i-1. 阅读全文
posted @ 2013-06-12 19:07 海拉鲁的林克 阅读(1864) 评论(0) 推荐(0) 编辑
摘要: 这次自己写了一下 总结起来就是: 归并排序递归和非递归形式是逆过程。 两者有的地方是一样的,不一样的地方是: 递归是递归拆分成一小段一小段的排序,同时是把A拆成A1 A2,先把A1整个排好,再排A2,最后达到排好整个A的目的。 非递归是序列从左往右先按等分的长度(i)逐个排好,长度不够i的在末尾,于是对它排一次序,然后让i两倍递增。#include <stdio.h>#include <string.h>#include <stdlib.h>#define MAX 1000#define OK 1#define ERROR 0using namespace 阅读全文
posted @ 2013-05-25 13:05 海拉鲁的林克 阅读(421) 评论(3) 推荐(0) 编辑
摘要: 来源 : http://www.cnblogs.com/liushang0419/archive/2011/09/19/2181476.html归并排序的确是分治思想的经典代表。写了很多次,这次又有新的收获,过去用的是递归的实现方式,理论上任何用递归方法实现的代码都可以转换为非递归的形式,所以此例也不例外。然后再用非递归的实现方法上进行改进,完成了“自然归并”算法,这比直接归并效率要高一些。先给出基础的用递归方法实现的归并排序:View Code 其中归并函数中的合并方法没有单独写开,单独函数merge()及其解释如下:void merge(int fir,int end,int mid){ 阅读全文
posted @ 2013-05-25 11:57 海拉鲁的林克 阅读(551) 评论(0) 推荐(0) 编辑
摘要: 先上题目Problem Description The most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas calle... 阅读全文
posted @ 2013-05-04 20:44 海拉鲁的林克 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 出处:http://blog.sina.com.cn/s/blog_7502c77f0100ye4h.html首先,我们看看前序、中序、后序遍历的特性:前序遍历:1.访问根节点2.前序遍历左子树3.前序遍历右子树中序遍历:1.中序遍历左子树2.访问根节点3.中序遍历右子树后序遍历:1.后序遍历左子树2.后序遍历右子树3.访问根节点好了,先说说用前序遍历和中序遍历求后序遍历假设前序遍历为 adbgcefh, 中序遍历为 dgbaechf前序遍历是先访问根节点,然后再访问子树的,而中序遍历则先访问左子树再访问根节点那么把前序的 a 取出来,然后查找 a 在中序遍历中的位置就得到 dgb a ech 阅读全文
posted @ 2013-04-24 09:25 海拉鲁的林克 阅读(447) 评论(0) 推荐(0) 编辑
摘要: 先上题目: Problem DescriptionIn the new year party, everybody will get a "special present".Now it's your turn to get your special present, a lot of presents now putting on the desk, and only one of them will be yours.Each present has a card number on it, and your present's card number 阅读全文
posted @ 2013-04-23 23:28 海拉鲁的林克 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 注册了HDU的账号以后从1001开始按顺序可以做的就做下去,先上题目:Big NumberTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18921Accepted Submission(s): 8458Problem DescriptionIn many applications very large integers numbers are required. Some of these applications are using key 阅读全文
posted @ 2013-03-30 14:07 海拉鲁的林克 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 很久没有写博客了。 先上题目: Saigyouji Yuyuko (西行寺幽々子), the ghost from the calamitous nirvana, is the princess of Hakugyokurou (白玉楼) in the Netherworld, while Konpaku Youmu (魂魄妖夢), half-human half-phantom, is the gardener of Hakugyokurou. Yuyuko is famous as a "hungry ghost" having an immense appetite. 阅读全文
posted @ 2013-03-20 13:57 海拉鲁的林克 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 先上题目: PalindromesA regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string is read from left to right as when the string is read from right to left. A mirrored stri 阅读全文
posted @ 2013-02-07 01:09 海拉鲁的林克 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 先上题目:Linear Cellular AutomataA biologist is experimenting with DNA modification of bacterial colonies being grown in a linear array of culture dishes. By changing the DNA, he is able ``program" the bacteria to respond to the population density of the neighboring dishes. Population is measured o 阅读全文
posted @ 2013-02-06 21:45 海拉鲁的林克 阅读(1222) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 下一页