![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
文章平均质量分 81
水果妹妹踩前端的坑
这个作者很懒,什么都没留下…
展开
-
1012 The Best Rank (25 分)【最好的排序】
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-10-31 14:51:11 · 442 阅读 · 0 评论 -
1071 Speech Patterns (25 分)【map的使用】
1071 Speech Patterns (25 分)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 ...原创 2018-11-08 17:24:07 · 316 阅读 · 1 评论 -
1063 Set Similarity (25 分)【STL中vector与set的使用】
1063 Set Similarity (25 分)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 N...原创 2018-11-15 15:30:11 · 143 阅读 · 0 评论 -
1057 Stack (30 分)【stack模拟+二分】
1057 Stack (30 分)Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the t...原创 2018-11-12 11:28:15 · 1406 阅读 · 4 评论 -
1064 Complete Binary Search Tree (30 分)【二叉树中序转化成层序】
1064 Complete 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 key...原创 2018-11-16 09:54:51 · 162 阅读 · 0 评论 -
1048 Find Coins (25 分)【Hash散列】
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...原创 2018-11-22 20:48:36 · 332 阅读 · 0 评论 -
1152 Google Recruitment (20 分)【简单题】
In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is super-simple, a URL consisting of the first 10-digit p...原创 2018-12-28 20:29:53 · 616 阅读 · 0 评论 -
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 a...原创 2019-01-03 15:20:37 · 758 阅读 · 4 评论 -
1153 Decode Registration Card of PAT (25 分)【模拟(易超时)】
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...原创 2018-12-30 09:52:35 · 575 阅读 · 0 评论 -
1029 Median (25 分)【边输入边输出】
1029 Median (25 分)Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = { 9,...原创 2018-11-13 22:03:19 · 323 阅读 · 0 评论 -
1025 PAT Ranking (25 分)[排序(小范围和大范围排序)]
1025 PAT 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...原创 2018-11-08 15:19:08 · 251 阅读 · 0 评论 -
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...原创 2018-11-11 20:09:55 · 191 阅读 · 0 评论 -
1013 Battle Over Cities (25 分)【连通分量+dfs】
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...原创 2018-10-31 16:39:23 · 237 阅读 · 0 评论 -
PAT甲级--1014 Waiting in Line (30 分)【队列的使用】
Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The sp...原创 2018-10-27 19:57:10 · 388 阅读 · 0 评论 -
1011 World Cup Betting【水题】
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Si...原创 2018-10-30 19:02:26 · 503 阅读 · 0 评论 -
1034 Head of a Gang (30 分)【连通分量dfs变形】
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 relation is defined to be t...原创 2018-11-03 13:38:30 · 166 阅读 · 0 评论 -
1028 List Sorting (25 分)【简单排序】
1028 List Sorting (25 分)Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, t...原创 2018-11-09 21:27:37 · 551 阅读 · 0 评论 -
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 wait in line behind the yellow li...原创 2018-11-07 21:26:44 · 373 阅读 · 0 评论 -
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 distingu...原创 2018-11-05 09:52:55 · 332 阅读 · 0 评论 -
1027 Colors in Mars (20 分)【10进制转换为13进制】
1027 Colors in Mars (20 分)People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits a...原创 2018-11-13 21:09:26 · 507 阅读 · 0 评论 -
1110 Complete Binary Tree (25 分)【完全二叉树(dfs)】
Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (≤20) wh...原创 2019-01-04 15:51:49 · 318 阅读 · 0 评论 -
PAT甲级--1154 Vertex Coloring (25 分)【hash】
A proper vertex coloring is a labeling of the graph's vertices with colors such that no two vertices sharing the same edge have the same color. A coloring using at most k colors is called a (proper) k...原创 2018-12-30 21:59:57 · 304 阅读 · 0 评论 -
1090 Highest Price in Supply Chain (25 分)【dfs】
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 th...原创 2019-01-05 15:11:42 · 603 阅读 · 0 评论 -
PAT甲级1055 The World's Richest (25 分)【运行超时22分】
Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl...原创 2019-02-26 16:01:23 · 485 阅读 · 0 评论 -
PAT甲级题型整理
按题型整理最短路径类题目:1003 Emergency (Dijkstra)1018 Public Bike Management(Dijkstra+dfs 将所有最短路径都储存在vector中)1087 All Roads Lead to Rome(Dijkstra+dfs)1111 online Map(2次Dijkstra+dfs)二叉搜索树类题目:1043 Is...原创 2019-02-21 12:57:05 · 1167 阅读 · 0 评论 -
PAT甲级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 consecutive numbers. Now given ...原创 2019-02-26 19:53:49 · 219 阅读 · 0 评论 -
PAT甲级1079 Total Sales of Supply Chain (25 分)【dfs】
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 th...原创 2019-02-26 21:20:17 · 235 阅读 · 0 评论 -
PAT甲级1010 Radix (25 分)【二分查找+进制转换】
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive inte...原创 2019-03-19 12:03:38 · 259 阅读 · 0 评论 -
PAT甲级1111 Online Map (30 分)【Dijkstra+dfs】
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 is the fastest. It is g...原创 2019-04-01 11:34:56 · 348 阅读 · 0 评论 -
1066 Root of AVL Tree (25 分)【套建AVL树模板】
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-03-28 21:30:44 · 269 阅读 · 0 评论 -
PAT甲级1018 Public Bike Management (30 分)【Dijlstra+dfs】
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 the ...原创 2019-04-02 13:55:26 · 227 阅读 · 0 评论 -
1087 All Roads Lead to Rome (30 分)【dijkstra+dfs】
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.Input Specification:Each ...原创 2019-03-01 18:59:23 · 315 阅读 · 0 评论 -
PAT甲级1127 ZigZagging on a Tree (30 分)【后序中序转为先序并输出层序遍历(s型)】
1127ZigZagging on a Tree(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 traversal s...原创 2019-03-05 10:57:22 · 287 阅读 · 0 评论 -
PAT甲级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 name lists of all the courses.Input S...原创 2019-02-25 22:29:10 · 213 阅读 · 0 评论 -
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 less than the node's key. The right su...原创 2019-01-06 13:49:37 · 269 阅读 · 0 评论 -
1155 Heap Paths (30 分)【dfs】
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-01-02 16:52:47 · 212 阅读 · 0 评论 -
1106 Lowest Price in Supply Chain (25 分)【dfs】
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 th...原创 2019-01-07 10:55:38 · 233 阅读 · 0 评论 -
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 from 1 to 6) is traversed, the s...原创 2019-01-02 20:26:06 · 289 阅读 · 0 评论 -
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 less than the node's key. The right su...原创 2019-02-27 19:52:58 · 332 阅读 · 0 评论 -
1140 Look-and-say Sequence (20 分)
Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...whereDis in [0, 9] except 1. The (n+1)st number is a kind of description of the nth n...原创 2019-02-27 21:29:30 · 186 阅读 · 0 评论