PAT
文章平均质量分 79
weixin_38902950
这个作者很懒,什么都没留下…
展开
-
Counting Leaves(层序遍历问题_带层数)
1004 Counting Leaves(30 分) A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Specification: Each input file contains one...原创 2018-09-12 11:03:09 · 368 阅读 · 0 评论 -
1150 Travelling Salesman Problem (图,set)
1150Travelling Salesman Problem(25 分) The "travelling salesman problem" asks the following question: "Given a list of cities and the distances between each pair of cities, what is the shortest poss...原创 2019-03-01 12:36:33 · 77 阅读 · 0 评论 -
1148 Werewolf - Simple Version (暴力遍历)
1148Werewolf - Simple Version(20 分) Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game, player #1 said: "Pla...原创 2019-03-01 13:09:37 · 173 阅读 · 0 评论 -
1149 Dangerous Goods Packaging (25 分)(散列)
1149Dangerous Goods Packaging(25 分) When shipping goods with containers, we have to be careful not to pack some incompatible goods into the same container, or we might get ourselves in serious trou...原创 2019-03-01 13:15:33 · 193 阅读 · 0 评论 -
1145 Hashing - Average Search Time (25 分)(散列冲突检测)
1145Hashing - Average Search Time(25 分) The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of integer key...原创 2019-03-01 16:04:04 · 372 阅读 · 0 评论 -
1146 Topological Order (25 分)(拓扑排序)
1146Topological Order(25 分) This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supp...原创 2019-03-01 17:08:14 · 151 阅读 · 0 评论 -
1147 Heaps (30 分)(最大堆的判断和二叉树的遍历)
1147Heaps(30 分) In computer science, aheapis a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater ...原创 2019-03-01 21:19:46 · 494 阅读 · 0 评论 -
1153 Decode Registration Card of PAT (25 分)(hash)
1153 Decode Registration Card of PAT (25 分) A registration card number of PAT consists of 4 parts: the 1st letter represents the test level, namely, T for the top level, A for advance and B for basi...原创 2019-02-26 17:03:20 · 184 阅读 · 1 评论 -
1022 Digital Library (30 分)(HashMap,TreeSet)
1022Digital Library(30 分) A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assign...原创 2019-03-08 19:22:53 · 107 阅读 · 0 评论 -
1020 Tree Traversals (25 分)
1020Tree Traversals(25 分) Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order ...原创 2019-03-03 21:40:18 · 178 阅读 · 0 评论 -
1021 Deepest Root (25 分)(DFS,BFS)
1021Deepest Root(25 分) A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a ...原创 2019-03-04 15:54:54 · 114 阅读 · 0 评论 -
1017 Queueing at Bank (排序,队列)
1017 Queueing at Bank (25 分) Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wai...原创 2019-02-13 10:02:22 · 135 阅读 · 0 评论 -
1155 Heap Paths (30 分)(最大堆)
1155 Heap Paths (30 分) In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either gre...原创 2019-02-23 20:20:07 · 215 阅读 · 0 评论 -
Product of Polynomials (多项式的乘法,链表)
1009 Product of Polynomials (25 分) This time, you are supposed to find A×B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occupies 2 lines...原创 2018-09-17 14:24:22 · 311 阅读 · 0 评论 -
Emergency(单源最短路径问题)
1003 Emergency(25 分) As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams ...原创 2018-09-10 16:02:32 · 172 阅读 · 0 评论 -
1010 Radix (二分查找)
1010 Radix (25 分) Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number. Now for any pa...原创 2018-09-18 18:52:18 · 275 阅读 · 0 评论 -
Spell It Rirht (Stack的使用)
1005 Spell It Right (20 分) Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each input file...原创 2018-09-13 18:42:58 · 118 阅读 · 0 评论 -
Sign in and sign out (字符串的比较大小)
1006 Sign In and Sign Out (25 分) At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the reco...原创 2018-09-13 19:28:50 · 654 阅读 · 0 评论 -
1012 The Best Rank (排序)
1012 The Best Rank (25 分) To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or L...原创 2018-09-19 14:56:10 · 104 阅读 · 0 评论 -
1013 Battle Over Cities (图的遍历DFS和BFS)
1013 Battle Over Cities (25 分) It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We...原创 2019-01-30 12:43:56 · 124 阅读 · 0 评论 -
StreamTokenizer的使用
//直接在程序中指定了文件输入路径:String fileName = "d:/ceshi.txt"; package szu.edu; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.io.StreamTokenizer; /** * 使用...转载 2019-02-09 17:24:42 · 442 阅读 · 0 评论 -
1016 Phone Bills (排序,对时间的处理)
1016 Phone Bills (25 分) A long-distance telephone company charges its customers by the following rules: Making a long-distance call costs a certain amount per minute, depending on the time of day wh...原创 2019-02-09 17:38:15 · 243 阅读 · 0 评论 -
1018 Public Bike Management (Dijkstra和DFS)
1018 Public Bike Management (30 分) There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and ret...原创 2019-02-23 16:48:49 · 97 阅读 · 0 评论 -
1025 PAT Ranking (25 分)(归并排序的思想)
1025PAT Ranking(25 分) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several pl...原创 2019-03-11 14:09:54 · 256 阅读 · 0 评论