
pat甲级
星辰浩宇
路在脚下
展开
-
1018 Public Bike Management-PAT甲级
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 return it to any other stations in t...原创 2019-07-20 10:57:48 · 411 阅读 · 0 评论 -
1094 The Largest Generation-PAT甲级
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 with the largest population....原创 2019-07-25 08:22:46 · 111 阅读 · 0 评论 -
1077 Kuchiguse-PAT甲级
题目描述The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is ...原创 2019-08-02 16:01:08 · 360 阅读 · 0 评论 -
1087 All Roads Lead to Rome-PAT甲级
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 happiness.输入描述:Each input fi...原创 2019-07-21 11:24:21 · 148 阅读 · 0 评论 -
1078 Hashing-PAT甲级
题目描述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 to be "H(key)...原创 2019-08-02 16:53:31 · 139 阅读 · 0 评论 -
1079 Total Sales of Supply Chain-PAT甲级
题目描述A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone...原创 2019-08-03 08:31:05 · 118 阅读 · 0 评论 -
1090 Highest Price in Supply Chain-PAT甲级
A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on ...原创 2019-07-21 19:47:25 · 112 阅读 · 0 评论 -
1080 Graduate Admission-PAT甲级
题目描述It is said that in 2013, there were about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the ...原创 2019-08-03 08:05:06 · 97 阅读 · 0 评论 -
1056 Mice and Rice -PAT甲级
题目描述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 mouse is to eat as m...原创 2019-08-03 09:59:30 · 148 阅读 · 0 评论 -
1058 A+B in Hogwarts -PAT甲级
题目描述If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon and twenty-nine Knuts ...原创 2019-08-03 11:34:37 · 135 阅读 · 0 评论 -
1095 Cars on Campus-PAT甲级
Zhejiang University has 6 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 information available, you a...原创 2019-07-25 20:32:03 · 99 阅读 · 0 评论 -
1059 Prime Factors-PAT甲级
题目描述Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1^k1 * p2^k2 *...*pm^km.输入描述:Each input file contains one test case wh...原创 2019-08-03 15:58:43 · 120 阅读 · 0 评论 -
1060 Are They Equal-PAT甲级
题目描述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 given the number of s...原创 2019-08-03 17:24:16 · 106 阅读 · 0 评论 -
1063 Set Similarity-PAT甲级
题目描述Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total number of disti...原创 2019-08-03 19:39:11 · 127 阅读 · 0 评论 -
1064 Complete Binary Search Tree -PAT甲级
题目描述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 less than the node's key. The ri...原创 2019-08-04 19:12:32 · 121 阅读 · 0 评论 -
1091 Acute Stroke-PAT甲级
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 MRI slice, your job is t...原创 2019-07-22 19:17:29 · 282 阅读 · 0 评论 -
1065 A+B and C (64bit)-PAT甲级
题目描述Given three integers A, B and C in [-263, 263), you are supposed to tell whether A+B > C.输入描述:The first line of the input gives the positive number of test cases, T (<=1000). The...原创 2019-08-04 21:09:07 · 110 阅读 · 0 评论 -
1096 Consecutive Factors-PAT甲级
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 consecutive numbers. Now giv...原创 2019-08-02 09:09:51 · 129 阅读 · 0 评论 -
1097 Deduplication on a Linked List-PAT甲级
题目描述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, only the first node of which the va...原创 2019-08-02 10:15:45 · 108 阅读 · 0 评论 -
1089 Insert or Merge-PAT甲级
According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from th...原创 2019-08-02 10:20:46 · 120 阅读 · 0 评论 -
Build A Binary Search Tree
题目描述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 less than the node's key.The rig...原创 2019-08-02 11:21:12 · 247 阅读 · 0 评论 -
1076 Forwards on Weibo-PAT甲级
题目描述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 with followers relations...原创 2019-08-02 12:10:26 · 137 阅读 · 0 评论 -
1020 Tree Traversals -PAT甲级
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 traversal sequence of the cor...原创 2019-08-14 14:22:29 · 114 阅读 · 0 评论 -
1143 Lowest Common Ancestor -PAT甲级
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.A binary search tree (BST) is recursively defined as a binary tree which has ...原创 2019-08-18 16:34:45 · 166 阅读 · 0 评论 -
1150 Travelling Salesman Problem-PAT甲级
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 possible route that visits each city and retu...原创 2019-08-18 17:42:49 · 199 阅读 · 0 评论 -
1149 Dangerous Goods Packaging-PAT甲级
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 trouble. For example, oxidizing agent (氧化剂)...原创 2019-08-18 18:10:41 · 202 阅读 · 0 评论 -
1148 Werewolf - Simple Version-PAT甲级
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: "Player #2 is a werewolf."; player #2 said...原创 2019-08-18 19:48:10 · 143 阅读 · 0 评论 -
1147 Heaps-PAT甲级
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 than or equal to (i...原创 2019-08-18 20:09:59 · 127 阅读 · 0 评论 -
1146 Topological Order-PAT甲级(图的拓扑排序)
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 supposed to write a program to test...原创 2019-08-19 20:46:40 · 171 阅读 · 0 评论 -
1145 Hashing - Average Search Time-PAT甲级(素数表的建立+哈希表)
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 from the table and output the average sea...原创 2019-08-19 07:38:39 · 164 阅读 · 0 评论 -
1144 The Missing Number-PAT甲级(数的排序+遍历)
Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test case. For each case, the first line giv...原创 2019-08-19 07:54:53 · 135 阅读 · 0 评论 -
1142 Maximal Clique-PAT甲级
A clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. A maximal clique is a clique that cannot be extended by including one more adj...原创 2019-08-19 09:26:03 · 121 阅读 · 0 评论 -
1141 PAT Ranking of Institutions-PAT甲级(多重排序+map)
After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist.Input Specification:Each input file conta...原创 2019-08-19 10:22:30 · 126 阅读 · 0 评论 -
1139 First Contact -PAT甲级(集合的交集)
Unlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years. When a boy A had a crush on a girl B, he would usually not contact her directly i...原创 2019-08-19 14:41:13 · 394 阅读 · 0 评论 -
1067 Sort with Swap(0, i)-PAT甲级
题目描述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? For example, to sort...原创 2019-08-10 09:53:30 · 144 阅读 · 0 评论 -
1135 Is It A Red-Black Tree-PAT甲级
There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red or black. (2) The root is black. (3) Every...原创 2019-08-19 17:45:46 · 106 阅读 · 0 评论 -
1068 Find More Coins-PAT甲级
题目描述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 coins as payments. ...原创 2019-08-10 11:45:10 · 107 阅读 · 0 评论 -
1053 Path of Equal Weight-PAT甲级
Given a non-empty tree with root RRR, and with weight WiW_iWi assigned to each tree node TiT_iTi. The weight of a path from RRR to LLL is defined to be the sum of the weights of all the nodes al...原创 2019-08-14 17:15:17 · 106 阅读 · 0 评论 -
1123 Is It a Complete AVL Tree-PAT甲级
An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is...原创 2019-08-19 20:45:53 · 127 阅读 · 0 评论 -
1071 Speech Patterns-PAT甲级
题目描述People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzing such patterns can help to narrow down a ...原创 2019-08-10 15:11:03 · 89 阅读 · 0 评论