PAT
isunLt
这个作者很懒,什么都没留下…
展开
-
PAT (Advanced Level) 1078 Hashing
1078 Hashing (25 分)The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined t...原创 2019-02-09 16:32:00 · 198 阅读 · 0 评论 -
PAT (Advanced Level) 1094 The Largest Generation
1094 The Largest Generation (25 分)A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation w...原创 2019-02-17 16:50:17 · 135 阅读 · 0 评论 -
PAT (Advanced Level)
1060 Are They Equal (25 分)If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×105 with simple chopping. Now...原创 2019-02-11 19:27:53 · 290 阅读 · 0 评论 -
PAT (Advanced Level) 1102 Invert a Binary Tree (25 分)
1102 Invert a Binary Tree (25 分)The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fu...原创 2019-02-17 21:58:54 · 178 阅读 · 0 评论 -
PAT (Advanced Level) 1100 Mars Numbers (20 分)
1100 Mars Numbers (20 分)People on Mars count their numbers with base 13:Zero on Earth is called “tret” on Mars.The numbers 1 to 12 on Earth is called “jan, feb, mar, apr, may, jun, jly, aug, sep, ...原创 2019-02-23 11:03:30 · 197 阅读 · 0 评论 -
PAT (Advanced Level) 1051 Pop Sequence (25 分)
1051 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 pos...原创 2019-02-12 16:16:20 · 162 阅读 · 0 评论 -
PAT (Advanced Level) 1105 Spiral Matrix (25 分)
1105 Spiral Matrix (25 分)This time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the first element at the upper...原创 2019-02-23 12:34:37 · 156 阅读 · 0 评论 -
PAT (Advanced Level) 1106 Lowest Price in Supply Chain (25 分)
1106 Lowest Price in Supply Chain (25 分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Startin...原创 2019-02-18 14:01:01 · 145 阅读 · 0 评论 -
PAT (Advanced Level) 1115 Counting Nodes in a BST
1115 Counting Nodes in a BST (30 分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:* The left subtree of a node contains only nodes with keys le...原创 2019-02-18 14:55:24 · 151 阅读 · 0 评论 -
PAT (Advanced Level) 1148 Werewolf - Simple Version (20 分)
1148 Werewolf - 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: "P...原创 2019-02-23 20:28:48 · 192 阅读 · 0 评论 -
PAT (Advanced Level) 1090 Highest Price in Supply Chain (25 分)
1090 Highest Price in Supply Chain (25 分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starti...原创 2019-02-17 16:00:54 · 288 阅读 · 0 评论 -
PAT (Advanced Level) 1086 Tree Traversals Again (25 分)
1086 Tree Traversals Again (25 分)An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered f...原创 2019-02-17 15:23:13 · 216 阅读 · 0 评论 -
PAT (Advanced Level) 1047 Student List for Course (25 分)
1047 Student List for Course (25 分)Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student nam...原创 2019-02-11 15:03:29 · 424 阅读 · 1 评论 -
PAT (Advanced Level) 1059 Prime Factors (25 分)
1059 Prime Factors (25 分)Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1k1×p2k2×⋯×pmkm.Input Specifica...原创 2019-02-09 20:57:23 · 210 阅读 · 0 评论 -
PAT (Advanced Level) 1053 Path of Equal Weight (30 分)
1053 Path of Equal Weight (30 分)Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of...原创 2019-02-16 14:20:37 · 137 阅读 · 0 评论 -
PAT (Advanced Level) 1048 Find Coins (25 分)
1048 Find Coins (25 分)Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coin...原创 2019-02-21 22:24:20 · 151 阅读 · 0 评论 -
PAT (Advanced Level) 1043 Is It a Binary Search Tree (25 分)
1043 Is It a Binary Search Tree (25 分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys ...原创 2019-02-16 20:58:02 · 181 阅读 · 0 评论 -
PAT (Advanced Level) 1096 Consecutive Factors (20 分)
1096 Consecutive Factors (20 分)Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, and 7 are the three...原创 2019-02-22 11:36:37 · 261 阅读 · 0 评论 -
PAT (Advanced Level) 1092 To Buy or Not to Buy (20 分)
1092 To Buy or Not to Buy (20 分)Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the...原创 2019-02-22 12:38:02 · 276 阅读 · 0 评论 -
PAT (Advanced Level) 1099 Build A Binary Search Tree (30 分)
1099 Build A Binary Search Tree (30 分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys ...原创 2019-02-22 13:30:00 · 253 阅读 · 0 评论 -
PAT (Advanced Level) 1079 Total Sales of Supply Chain (25 分)
1079 Total Sales of Supply Chain (25 分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting...原创 2019-02-17 11:55:56 · 203 阅读 · 0 评论 -
PAT (Advanced Level) 1039 Course List for Student (25 分)
1039 Course List for Student (25 分)Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered cou...原创 2019-02-11 12:10:33 · 186 阅读 · 0 评论 -
PAT (Advanced Level) 1149 Dangerous Goods Packaging (25 分)
1149 Dangerous 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 troub...原创 2019-02-23 20:31:38 · 171 阅读 · 0 评论 -
PAT (Advanced Level) 1150 Travelling Salesman Problem (25 分)
1150 Travelling 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 possi...原创 2019-02-23 20:34:56 · 189 阅读 · 0 评论 -
PAT (Advanced Level) 1098 Insertion or Heap Sort (25 分)
1098 Insertion or Heap Sort (25 分)According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort remov...原创 2019-02-19 16:32:02 · 141 阅读 · 0 评论 -
PAT (Advanced Level) 1097 Deduplication on a Linked List (25 分)
1097 Deduplication on a Linked List (25 分)Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K, ...原创 2019-02-14 12:14:53 · 209 阅读 · 0 评论 -
PAT (Advanced Level) 1034 Head of a Gang
1034 Head of a Gang (30 分)One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a ...原创 2019-02-19 22:47:31 · 143 阅读 · 0 评论 -
PAT (Advanced Level) 1076 Forwards on Weibo (30 分)
1076 Forwards on Weibo (30 分)Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed wit...原创 2019-02-20 12:45:56 · 154 阅读 · 0 评论 -
PAT (Advanced Level) 1087 All Roads Lead to Rome (30 分)
1087 All Roads Lead to Rome (30 分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happ...原创 2019-02-20 18:02:18 · 233 阅读 · 0 评论 -
PAT (Advanced Level) 1111 Online Map (30 分)
1111 Online Map (30 分)Input our current position and a destination, an online map can recommend several paths. Now your job is to recommend two paths to your user: one is the shortest, and the other ...原创 2019-02-20 22:18:18 · 171 阅读 · 0 评论 -
PAT (Advanced Level) 1146 Topological Order (25 分)
1146 Topological 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 suppo...原创 2019-02-21 11:30:40 · 316 阅读 · 0 评论 -
2019年3月2日PAT后记
2019年3月2日PAT后记昨天去浙大紫金港考了pat,结果很不理想,只有60分,但这是因为,我最后一题快打完的时候,电脑蓝屏了,代码没保存,所以打了1个多小时的代码全没了。蓝屏重启后还剩30分钟,但那时心态有点炸,就没再继续考试了。这里写下,关于紫金港机房编译环境,后序复习方法的总结,希望对后续的考试有所帮助。编译环境在考试前我一直想找紫金港机房有什么编译环境,但是一直找不到,后来我去紫金...原创 2019-03-03 17:00:36 · 910 阅读 · 0 评论 -
PAT (Advanced Level) 1035 Password (20 分)
1035 Password (20 分)To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to distingui...原创 2019-03-09 19:41:54 · 191 阅读 · 0 评论 -
PAT (Advanced Level) 1052 Linked List Sorting
1052 Linked List Sorting (25 分)A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer...原创 2019-02-13 22:29:53 · 150 阅读 · 0 评论 -
PAT (Advanced Level) 1118 Birds in Forest (25 分)
1118 Birds in Forest (25 分)Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the ...原创 2019-02-19 13:28:28 · 149 阅读 · 0 评论 -
PAT (Advanced Level) 1056 Mice and Rice (25 分)
1056 Mice and Rice (25 分)Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mo...原创 2019-02-13 18:36:06 · 209 阅读 · 0 评论 -
PAT (Advanced Level) 1151 LCA in a Binary Tree (30 分)
1151 LCA in a Binary Tree (30 分)The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.Given any two nodes in a binary tree, you are...原创 2019-02-23 20:38:34 · 181 阅读 · 0 评论 -
PAT (Advanced Level) 1119 Pre- and Post-order Traversals (30 分)
1119 Pre- and Post-order Traversals (30 分)Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder tr...原创 2019-02-18 16:48:23 · 255 阅读 · 0 评论 -
PAT (Advanced Level) 1147 Heaps (30 分)
1147 Heaps (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 greater t...原创 2019-02-23 21:19:40 · 164 阅读 · 0 评论 -
PAT (Advanced Level) 1145 Hashing - Average Search Time (25 分)
1145 Hashing - 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 keys...原创 2019-02-23 22:00:57 · 169 阅读 · 0 评论