07 2014 档案

摘要:DescriptionConsider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree whose root nod... 阅读全文
posted @ 2014-07-31 09:06 冷夏的博客园 阅读(231) 评论(0) 推荐(0)
摘要:二叉树的非递归遍历 二叉树是一种非常重要的数据结构,很多其它数据结构都是基于二叉树的基础演变而来的。对于二叉树,有前序、中序以及后序三种遍历方法。因为树的定义本身就是递归定义,因此采用递归的方法去实现树的三种遍历不仅容易理解而且代码很简洁。而对于树的遍历若采用非递归的方法,就要采用栈去模拟... 阅读全文
posted @ 2014-07-30 20:33 冷夏的博客园 阅读(95) 评论(0) 推荐(0)
摘要:DescriptionLittle Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital l... 阅读全文
posted @ 2014-07-30 19:32 冷夏的博客园 阅读(320) 评论(0) 推荐(0)
摘要:DescriptionBackgroundBinary trees are a common data structure in computer science. In this problem we will look at an infinite binary tree where the n... 阅读全文
posted @ 2014-07-30 18:30 冷夏的博客园 阅读(369) 评论(0) 推荐(0)
摘要:A -Tree Grafting(9.1.1)Time Limit:5000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionTrees have many applications in comput... 阅读全文
posted @ 2014-07-30 18:01 冷夏的博客园 阅读(297) 评论(0) 推荐(0)
摘要:A -敌兵布阵Time Limit:1000MSMemory Limit:32768KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionC国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸... 阅读全文
posted @ 2014-07-30 10:58 冷夏的博客园 阅读(100) 评论(0) 推荐(0)
摘要:Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的... 阅读全文
posted @ 2014-07-29 19:49 冷夏的博客园 阅读(164) 评论(0) 推荐(0)
摘要:DescriptionSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. ... 阅读全文
posted @ 2014-07-29 19:02 冷夏的博客园 阅读(164) 评论(0) 推荐(0)
摘要:DescriptionThere are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out ... 阅读全文
posted @ 2014-07-28 16:55 冷夏的博客园 阅读(144) 评论(0) 推荐(0)
摘要:DescriptionProblem IFriendsThere is a town with N citizens. It is known that some pairs of people are friends. According to the famous saying that “Th... 阅读全文
posted @ 2014-07-28 16:38 冷夏的博客园 阅读(172) 评论(0) 推荐(0)
摘要:有一棵二叉树,最大深度为D,且所有叶子的深度都相同。所有结点从上到下从左到右编号为1,2,3,...,2^D-1。在结点1处放一个小球,它会往下落。每个内结点上都有一个开关,初始全部关闭,当每次有小球落到一个开关上时,它的状态都会改变。当小球到达一个内结点时,如果该结点上的开关关闭,则往左走,否者往... 阅读全文
posted @ 2014-07-27 21:07 冷夏的博客园 阅读(396) 评论(0) 推荐(0)
摘要:A very big corporation is developing its corporative network. In the beginning each of the N enterprises of the corporation, numerated from 1 to N, or... 阅读全文
posted @ 2014-07-27 17:16 冷夏的博客园 阅读(214) 评论(0) 推荐(0)
摘要:X-PlosivesA secret service developed a new kind of explosive that attain its volatile property only when a specific association of products occurs. Ea... 阅读全文
posted @ 2014-07-27 16:24 冷夏的博客园 阅读(280) 评论(0) 推荐(0)
摘要:#include #include #include using namespace std;int i;int main(){multimap m;multimap ::iterator kan,kan1,it; m.insert(pair('a', 1)); m.insert(pair('a',... 阅读全文
posted @ 2014-07-24 19:42 冷夏的博客园 阅读(536) 评论(0) 推荐(0)
摘要:DescriptionThe cows are thrilled because they've just learned about encrypting messages. They think they will be able to use secret messages to plot m... 阅读全文
posted @ 2014-07-24 10:56 冷夏的博客园 阅读(226) 评论(0) 推荐(0)
摘要:#include using namespace std;int main(){string a ;cin>>a;int i,next[100];//主要程序next[0]=-1;i=0;int j=-1;while(i<a.length()){ if(j==-1||a[i]==a[j]) {i++... 阅读全文
posted @ 2014-07-23 18:31 冷夏的博客园 阅读(132) 评论(0) 推荐(0)
摘要:DescriptionA rooted tree is a well-known data structure in computer science and engineering. An example is shown below:In the figure, each node is lab... 阅读全文
posted @ 2014-07-23 13:53 冷夏的博客园 阅读(215) 评论(0) 推荐(0)
摘要:#include #include #include using namespace std;int main(){mapm; map::iterator kan1;map::iterator kan;int a;m[1]=3;m[3]=45415145;m[6]=2;m[8]=415;//whil... 阅读全文
posted @ 2014-07-22 16:36 冷夏的博客园 阅读(703) 评论(0) 推荐(0)
摘要:DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you ... 阅读全文
posted @ 2014-07-22 14:34 冷夏的博客园 阅读(218) 评论(0) 推荐(0)
摘要:SubmitStatusDescriptionHardwoods are the botanical group of trees that have broad leaves, produce a fruit or nut, and generally go dormant in the wint... 阅读全文
posted @ 2014-07-22 14:07 冷夏的博客园 阅读(206) 评论(0) 推荐(0)
摘要:用时24小时,,,大神勿喷DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. U... 阅读全文
posted @ 2014-07-21 18:34 冷夏的博客园 阅读(174) 评论(0) 推荐(0)
摘要:DescriptionThe Dole QueueIn a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoceros Party has decided on the f... 阅读全文
posted @ 2014-07-21 10:47 冷夏的博客园 阅读(286) 评论(0) 推荐(0)
摘要:DescriptionThe Genographic Project is a research partnership between IBM and The National Geographic Society that is analyzing DNA from hundreds of th... 阅读全文
posted @ 2014-07-17 21:01 冷夏的博客园 阅读(201) 评论(0) 推荐(0)
摘要:#include using namespace std;char a[100][10000];int p1,p2,b[100],n,k;bool p(int p1,int p2){int i,j; if(p1==n-1)return 1;else{ for(i=p2;i>t; while(t--)... 阅读全文
posted @ 2014-07-17 17:15 冷夏的博客园 阅读(190) 评论(0) 推荐(0)
摘要:SubmitStatusDescriptionThe Antique Comedians of Malidinesia prefer comedies to tragedies. Unfortunately, most of the ancient plays are tragedies. Ther... 阅读全文
posted @ 2014-07-16 17:19 冷夏的博客园 阅读(231) 评论(0) 推荐(0)
摘要:DescriptionA calendar is a system for measuring time, from hours and minutes, to months and days, and finally to years and centuries. The terms of hou... 阅读全文
posted @ 2014-07-16 16:42 冷夏的博客园 阅读(263) 评论(0) 推荐(0)
摘要:DescriptionA fractal is an object or quantity that displays self-similarity, in a somewhat technical sense, on all scales. The object need not exhibit... 阅读全文
posted @ 2014-07-16 15:25 冷夏的博客园 阅读(387) 评论(0) 推荐(1)
摘要:DescriptionIn your job at Albatross Circus Management (yes, it's run by a bunch of clowns), you have just finished writing a program whose output is a... 阅读全文
posted @ 2014-07-16 15:24 冷夏的博客园 阅读(264) 评论(0) 推荐(0)
摘要:DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a... 阅读全文
posted @ 2014-07-16 15:22 冷夏的博客园 阅读(183) 评论(0) 推荐(0)
摘要:原题 http://poj.org/problem?id=1011答案(比较全)http://www.cnblogs.com/mycapple/archive/2012/08/14/2638430.html#commentformSticksTime Limit: 1000MSMemory Limi... 阅读全文
posted @ 2014-07-16 13:35 冷夏的博客园 阅读(366) 评论(0) 推荐(0)
摘要:Total Submissions: 5204Accepted: 2481DescriptionPascal University, one of the oldest in the country, needs to renovate its Library Building, because a... 阅读全文
posted @ 2014-07-14 19:52 冷夏的博客园 阅读(180) 评论(0) 推荐(0)
摘要:DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this pr... 阅读全文
posted @ 2014-07-14 16:10 冷夏的博客园 阅读(213) 评论(0) 推荐(0)
摘要:DescriptionIn 1949 the Indian mathematician D.R. Kaprekar discovered a class of numbers called self-numbers. For any positive integer n, define d(n) t... 阅读全文
posted @ 2014-07-14 16:03 冷夏的博客园 阅读(264) 评论(0) 推荐(0)
摘要:DescriptionThe king pays his loyal knight in gold coins. On the first day of his service, the knight receives one gold coin. On each of the next two d... 阅读全文
posted @ 2014-07-14 16:03 冷夏的博客园 阅读(367) 评论(0) 推荐(0)
摘要:DescriptionMany graduate students of Peking University are living in Wanliu Campus, which is 4.5 kilometers from the main campus – Yanyuan. Students i... 阅读全文
posted @ 2014-07-14 16:01 冷夏的博客园 阅读(311) 评论(0) 推荐(0)
摘要:DescriptionBill and Ted are taking a road trip. But the odometer in their car is broken, so they don't know how many miles they have driven. Fortunate... 阅读全文
posted @ 2014-07-14 15:57 冷夏的博客园 阅读(297) 评论(0) 推荐(0)
摘要:Description题目描述:大家知道,给出正整数n,则1到n这n个数可以构成n!种排列,把这些排列按照从小到大的顺序(字典顺序)列出,如n=3时,列出1 2 3,1 3 2,2 1 3,2 3 1,3 1 2,3 2 1六个排列。任务描述:给出某个排列,求出这个排列的下k个排列,如果遇到最后一个... 阅读全文
posted @ 2014-07-14 15:53 冷夏的博客园 阅读(236) 评论(0) 推荐(0)
摘要:DescriptionUgly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ... shows the first 10 ugly n... 阅读全文
posted @ 2014-07-14 15:51 冷夏的博客园 阅读(409) 评论(0) 推荐(0)
摘要:DescriptionWrite a program to read four lines of upper case (i.e., all CAPITAL LETTERS) text input (no more than 72 characters per line) from the inpu... 阅读全文
posted @ 2014-07-14 15:46 冷夏的博客园 阅读(265) 评论(0) 推荐(0)
摘要:DescriptionIf a and d are relatively prime positive integers, the arithmetic sequence beginning witha and increasing by d, i.e., a, a + d,a + 2d, a + ... 阅读全文
posted @ 2014-07-14 15:45 冷夏的博客园 阅读(305) 评论(0) 推荐(0)
摘要:DescriptionA checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum... 阅读全文
posted @ 2014-07-14 15:44 冷夏的博客园 阅读(197) 评论(0) 推荐(0)
摘要:SubmitStatusDescriptionFind and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum ... 阅读全文
posted @ 2014-07-14 15:43 冷夏的博客园 阅读(241) 评论(0) 推荐(0)
摘要:DescriptionAdapted from Wikipedia, the free encyclopediaThe humidex is a measurement used by Canadian meteorologists to reflect the combined effect of... 阅读全文
posted @ 2014-07-14 15:42 冷夏的博客园 阅读(318) 评论(0) 推荐(0)
摘要:DescriptionHow far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We'... 阅读全文
posted @ 2014-07-14 15:38 冷夏的博客园 阅读(163) 评论(0) 推荐(0)
摘要:DescriptionFred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned th... 阅读全文
posted @ 2014-07-14 15:34 冷夏的博客园 阅读(155) 评论(0) 推荐(0)
摘要:DescriptionSome positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representations does a given pos... 阅读全文
posted @ 2014-07-14 15:33 冷夏的博客园 阅读(203) 评论(0) 推荐(0)
摘要:B - Doubles(1.2.1)Time Limit:1000MSMemory Limit:10000KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionAs part of an arithmetic competency program... 阅读全文
posted @ 2014-07-14 15:31 冷夏的博客园 阅读(248) 评论(0) 推荐(0)
摘要:A - Financial Management(1.1.1)Time Limit:1000MSMemory Limit:10000KB64bit IO Format:%I64d & %I64uSubmitStatusDescriptionLarry graduated this year and ... 阅读全文
posted @ 2014-07-14 15:29 冷夏的博客园 阅读(280) 评论(0) 推荐(0)