摘要:题目1172:哈夫曼树时间限制:1 秒内存限制:32 兆特殊判题:否提交:919解决:272题目描述:哈夫曼树,第一行输入一个数n,表示叶结点的个数。需要用这些叶结点生成哈夫曼树,根据哈夫曼树的概念,这些结点有权值,即weight,题目需要输出所有结点的值与权值的乘积之和。输入:输入有多组数据。每组第一行输入一个数n,接着输入n个叶节点(叶节点权值不超过100,2<=n<=1000)。输出:输出权值。样例输入:5 1 2 2 5 9样例输出:37来源:2010年北京邮电大学计算机研究生机试真题观察后不难发现,最后的结果就是所有节点(除掉跟节点)的节点之和。#include <
阅读全文
摘要:原题地址http://poj.org/problem?id=3517And Then There Was OneTime Limit:5000MSMemory Limit:65536KDescriptionLet’s play a stone removing game.Initially,nstones are arranged on a circle and numbered 1, …,nclockwise (Figure 1). You are also given two numberskandm. From this state, remove stones one by one f
阅读全文
摘要:原题地址http://poj.org/problem?id=3505Tower ParkingTime Limit:1000MSMemory Limit:65536KDescriptionThere is a new revolution in the parking lot business: the parking tower. The concept is simple: you drive your car into the elevator at the entrance of the tower, and the elevator and conveyor belts drag t
阅读全文
摘要:原题地址http://poj.org/problem?id=3852String LDTime Limit:1000MSMemory Limit:65536KDescriptionStringld (left delete) is a function that gets a string and deletes its leftmost character (for instance Stringld(“acm”) returns “cm”).You are given a list of distinct words, and at each step, we apply stringld
阅读全文
摘要:原题地址http://poj.org/problem?id=3914DuLLTime Limit:1000MSMemory Limit:65536KDescriptionIn Windows, a DLL (or dynamic link library) is a file that contains a collection of pre-compiled functions that can be loaded into a program at runtime. The two primary benefits of DLLs are (1) only one copy of a DL
阅读全文
摘要:本题的意思就是给你一个不能被2或5整除的数,输出这个数的倍数的最小位数,这个倍数全部由1组成显然,如果模拟计算的话需要高精度,数据多了可能会超时,还是得用数学方法111......111(n个1)=111......11(n-1个1)*10+1由于找的是它的倍数,所以在扩展的过程中为了防止数据类型的溢出可以取余运算while(tmp) { tmp=tmp*10+1; ++cnt; tmp%=n; } OnesTime Limit: 1000MSMemory Limit: 65536KDescriptionGiven any integer 0 <= n <= 10000 not..
阅读全文
摘要:http://poj.org/problem?id=2535Very Simple ProblemTime Limit:2000MSMemory Limit:65536KDescriptionDuring a preparation of programming contest, its jury is usually faced with many difficult tasks. One of them is to select a problem simple enough to most, if not all, contestants to solve.The difficulty
阅读全文
摘要:http://poj.org/problem?id=2606http://poj.org/problem?id=1118这里是O(n^3)实现 水过!Lining UpTime Limit:2000MSMemory Limit:32768KDescription"How am I ever going to solve this problem?" said the pilot.Indeed, the pilot was not facing an easy task. She had to drop packages at specific points scattere
阅读全文
摘要:http://poj.org/problem?id=1001WA了三次整数的幂忘记去掉小数点了!!!!!ExponentiationTime Limit:500MSMemory Limit:10000KDescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for many compu
阅读全文
摘要:http://poj.org/problem?id=2552Assistance RequiredTime Limit:1000MSMemory Limit:65536KDescriptionAfter the 1997/1998 Southwestern European Regional Contest (which was held in Ulm) a large contest party took place. The organization team invented a special mode of choosing those participants that were
阅读全文
摘要:http://poj.org/problem?id=3095简单字符串模拟Linear PachinkoTime Limit:1000MSMemory Limit:65536KDescriptionThis problem is inspired byPachinko, a popular game in Japan. A traditional Pachinko machine is a cross between a vertical pinball machine and a slot machine. The player launches small steel balls to t
阅读全文
摘要:http://poj.org/problem?id=2895Best SMS to TypeTime Limit:1000MSMemory Limit:65536KDescriptionUsing SMS today is more than a pleasing hobby. As the number of messages one sends through this service grows, the need to type them fast is better felt. Sometimes, one wonders how fast a message can be type
阅读全文
摘要:http://poj.org/problem?id=3032提交的时候正赶上系统故障,全是Runtime Error!!!一看Online Status,原来全是RT,POJ出故障了!!!!Card TrickTime Limit:1000MSMemory Limit:65536KDescriptionThe magician shuffles a small pack of cards, holds it face down and performs the following procedure:The top card is moved to the bottom of the pack
阅读全文
摘要:http://poj.org/problem?id=3183Stump RemovalTime Limit:1000MSMemory Limit:65536KDescriptionAlways thinking of the cows' grazing experience, FJ has found that he must remove N (1 <= N <= 50,000) unsightly stumps from the pasture. The stumps are conveniently arranged in a straight line and nu
阅读全文
摘要:http://poj.org/problem?id=3157Java vs C++Time Limit:2000MSMemory Limit:65536KDescriptionApologists of Java and C++ can argue for hours proving each other that their programming language is the best one. Java people will tell that their programs are clearer and less prone to errors, while C++ people
阅读全文
摘要:http://poj.org/problem?id=2993学会了用strtok()函数分割字符串Emag eht htiw Em PlehTime Limit:1000MSMemory Limit:65536KDescriptionThis problem is a reverse case of theproblem 2996. You are given the output of the problem H and your task is to find the corresponding input.Inputaccording to output ofproblem 2996.O
阅读全文
摘要:字符串模拟排序http://poj.org/problem?id=2996Help Me with the GameTime Limit:1000MSMemory Limit:65536KDescriptionYour task is to read a picture of a chessboard position and print it in the chess notation.InputThe input consists of an ASCII-art picture of a chessboard with chess pieces on positions described
阅读全文
摘要:http://poj.org/problem?id=3652Persistent BitsTime Limit:1000MSMemory Limit:65536KDescriptionWhatNext Software creates sequence generators that they hope will produce fairly random sequences of 16-bit unsigned integers in the range 0–65535. In general a sequence is specified by integersA,B,C, andS, w
阅读全文
摘要:简单模拟Unix系统中的ls目录列表功能不过需要注意,在计算列数的时候是62/MAX_LEN,而不是60/MAX_LEN对字符数组排序使用了qsort()系统函数Unix lsTime Limit:1000MSMemory Limit:10000KDescriptionThe computer company you work for is introducing a brand new computer line and is developing a new Unix-like operating system to be introduced along with the new com
阅读全文