- 博客(114)
- 收藏
- 关注
原创 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
302
原创 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
197
原创 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
181
原创 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
190
原创 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
186
原创 PAT (Advanced Level) 1114 Family Property (25 分)
1114 Family Property (25 分)This time, you are supposed to help us collect the data for family-owned property. Given each person’s family members, and the estate(房产)info under his/her own name, we nee...
2019-02-18 22:51:44
242
原创 PAT (Advanced Level) 1107 Social Clusters (30 分)
1107 Social Clusters (30 分)When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a set of ...
2019-02-18 20:33:46
186
原创 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
321
原创 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
198
原创 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
203
原创 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
236
原创 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
185
原创 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
329
原创 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
289
原创 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
241
原创 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
247
原创 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
178
原创 PAT (Advanced Level) 1091 Acute Stroke (30 分)
1091 Acute Stroke (30 分)One important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MR...
2019-02-15 15:01:13
204
原创 PAT (Advanced Level) 1103 Integer Factorization (30 分)
1103 Integer Factorization (30 分)The K−P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are supposed to write a program to find the K−P f...
2019-02-14 19:51:42
289
原创 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
257
原创 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
194
原创 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
262
原创 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
211
原创 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
347
原创 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
473
1
原创 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
241
原创 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
267
原创 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
254
原创 PAT (Advanced Level) 1049 Counting Ones (30 分)
1049 Counting Ones (30 分)The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N bein...
2019-02-09 11:10:25
187
原创 PAT (Advanced Level) 1104 Sum of Number Segments (20 分)
1104 Sum of Number Segments (20 分)Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we have 10 segmen...
2019-02-08 22:22:27
242
原创 PAT (Advanced Level) 1069 The Black Hole of Numbers (20 分)
1069 The Black Hole of Numbers (20 分)For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order,...
2019-02-08 11:50:27
214
原创 PAT (Advanced Level) 1101 Quick Sort (25 分)
1101 Quick Sort (25 分)There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pi...
2019-02-07 12:30:20
283
原创 1093 Count PAT's (25 分)
1093 Count PAT’s (25 分)The string APPAPT contains two PAT’s as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and t...
2019-02-07 10:36:00
206
原创 PAT (Advanced Level) 1089 Insert or Merge (25 分)
1089 Insert or Merge (25 分)According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one e...
2019-02-05 12:50:11
470
原创 PAT (Advanced Level) 1067 Sort with Swap(0, i) (25 分)
1067 Sort with Swap(0, i) (25 分)Given any permutation of the numbers {0, 1, 2,…, N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use...
2019-02-02 10:53:51
317
原创 PAT (Advanced Level) 1037 Magic Coupon (25 分)
1037 Magic Coupon (25 分)The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N times th...
2019-02-01 16:56:36
188
原创 PAT (Advanced Level) 1084 Broken Keyboard (20 分)
1084 Broken Keyboard (20 分)On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a stri...
2019-01-27 11:14:31
296
原创 PAT (Advanced Level) 1095 Cars on Campus (30 分)
1095 Cars on Campus (30 分)Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with all the i...
2019-01-05 21:03:00
557
原创 PAT (Advanced Level) 1080 Graduate Admission
1080 Graduate Admission (30 分)It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a pr...
2019-01-05 15:12:31
265
原创 PAT (Advanced Level) 1075 PAT Judge (25 分)
1075 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...
2019-01-04 21:55:42
280
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅