
PAT
Allenhong97
这个作者很懒,什么都没留下…
展开
-
Pop Sequence
02-线性结构4 Pop Sequence(25 分)Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a...原创 2018-05-09 15:29:59 · 457 阅读 · 0 评论 -
7-15 PAT Judge
7-15 PAT Judge(25 分)The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification:Ea...原创 2018-07-01 22:17:34 · 387 阅读 · 0 评论 -
7-12 How Long Does It Take(25 分)
7-12 How Long Does It Take(25 分)Given the relations of all the activities of a project, you are supposed to find the earliest completion time of the project.Input Specification:Each input file contain...原创 2018-06-25 22:19:31 · 926 阅读 · 0 评论 -
7-6 列出连通集
7-6 列出连通集(25 分)给定一个有N个顶点和E条边的无向图,请用DFS和BFS分别列出其所有的连通集。假设顶点从0到N−1编号。进行搜索时,假设我们总是从编号最小的顶点出发,按编号递增的顺序访问邻接点。输入格式:输入第1行给出2个整数N(0<N≤10)和E,分别是图的顶点数和边数。随后E行,每行给出一条边的两个端点。每行中的数字之间用1空格分隔。输出格式:按照"{ v1 v2...原创 2018-06-16 00:22:16 · 516 阅读 · 0 评论 -
7-10 公路村村通(30 分)
7-10 公路村村通(30 分)现有村落间道路的统计数据表中,列出了有可能建设成标准公路的若干条道路的成本,求使每个村落都有公路连通所需要的最低成本。输入格式:输入数据包括城镇数目正整数N(≤1000)和候选道路数目M(≤3N);随后的M行对应M条道路,每行给出3个正整数,分别是该条道路直接连通的两个城镇的编号以及该道路改建的预算成本。为简单起见,城镇从1到N编号。输出格式:输出村村通需要的最低成...原创 2018-06-23 16:25:17 · 646 阅读 · 0 评论 -
Huffman Codes(使用priority_queue)
05-树9 Huffman Codes (30分)In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Redundancy Codes", and hence printed his name in the history of computer science. As ...原创 2018-06-13 22:17:36 · 239 阅读 · 0 评论 -
7-9 旅游规划(25 分)
7-9 旅游规划(25 分)有了一张自驾旅游路线图,你会知道城市间的高速公路长度、以及该公路要收取的过路费。现在需要你写一个程序,帮助前来咨询的游客找一条出发地和目的地之间的最短路径。如果有若干条路径都是最短的,那么需要输出最便宜的一条路径。输入格式:输入说明:输入数据的第1行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0~(N−1);M是高速公路的条数...原创 2018-06-20 22:06:11 · 1627 阅读 · 0 评论 -
1002. A+B for Polynomials
1002. A+B for Polynomials (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one tes...转载 2018-05-06 23:24:38 · 201 阅读 · 0 评论 -
PAT甲级1001
1001. A+B Format (20)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueCalculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by co...原创 2018-05-06 12:14:43 · 248 阅读 · 0 评论 -
1001 A+B Format (20)
1001 A+B Format (20)(20 分)Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits).InputEa...原创 2018-07-02 12:36:14 · 230 阅读 · 0 评论