![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT (Advanced Level)
PAT (Advanced Level)刷题总结
Cnhhc
这个作者很懒,什么都没留下…
展开
-
1068 Find More Coins (30分)-01背包 、动态规划(01背包问题还没搞明白,待更新)
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. However, there was a special requirement of the payment: for eac原创 2020-06-30 13:51:18 · 125 阅读 · 0 评论 -
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 keys less than the node's key. The right subtree of a node contains only nodes with keys greater th原创 2020-06-30 00:18:08 · 104 阅读 · 0 评论 -
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 top position) and Pop (deleting the top element). Now you are supposed to im原创 2020-06-29 23:37:02 · 132 阅读 · 0 评论 -
1038 Recover the Smallest Number (30分)-数学分析
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like 32-321-3214-0229-87 or 0229-32-87-321-3214 with respect to different ord原创 2020-06-29 00:25:15 · 71 阅读 · 0 评论 -
1045 Favorite Color Stripe (30分)-求最长公共子序列
Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts together to form her favorite color stripe.It is said原创 2020-06-28 17:23:05 · 122 阅读 · 0 评论 -
1034 Head of a Gang (30分)-图的连通集,DFS,STL
One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call betweenAandB, we say thatAandBis related. The weight of a relation is defined to be the total time length of all the phone calls made between...原创 2020-06-27 19:53:19 · 79 阅读 · 0 评论 -
1026 Table Tennis (30分)-模拟队列、坑点分析
A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open when they arrive, they will be assigned to the available table with the smallest number. If all the tables原创 2020-06-26 23:43:14 · 626 阅读 · 0 评论 -
1030 Travel Plan (30分)-DFS & dijkstra、最短路径
A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to decide the shortest path between his/her starting city and the destination. If suc原创 2020-06-27 15:51:21 · 135 阅读 · 0 评论 -
1022 Digital Library (30分)-STL大杂烩
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 assigned an unique 7-digit number as its ID. Given any query from a reader, you are suppose原创 2020-06-25 01:17:36 · 97 阅读 · 0 评论 -
1018 Public Bike Management (30分)-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 city.The Public Bike Management Center (PBMC) keeps mo原创 2020-06-24 21:47:38 · 92 阅读 · 0 评论 -
1014 Waiting in Line (30分)-queue、坑点分析
Suppose a bank hasNwindows 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 space inside the yellow line in front of each window is enoug..原创 2020-06-24 16:31:32 · 452 阅读 · 1 评论 -
1004 Counting Leaves (30分)-map、vector
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 test case. Each case starts with a line containing0<N<100, the number of nod.原创 2020-06-24 01:28:41 · 71 阅读 · 0 评论 -
1107 Social Clusters (30分)-并查集
1107Social 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. Asocial clusteris a set of people who have some of their hobbies in common. You are...原创 2020-06-24 00:04:20 · 147 阅读 · 0 评论 -
1131 Subway Map (30分)-DFS,最短路径(待更新)
In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are supposed to help people with your computer skills! Given the starting position of your u原创 2020-06-23 19:39:33 · 113 阅读 · 0 评论 -
1115 Counting Nodes in a BST (30分)-BST插入、求高、遍历
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 or equal to the node's key. The right subtree of a node contains only nodes with key原创 2020-06-23 00:07:24 · 54 阅读 · 0 评论 -
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 traversal sequences, or preorder and inorder traversal sequences. However, if only the postorder and原创 2020-06-22 22:54:30 · 176 阅读 · 0 评论 -
1127 ZigZagging on a Tree (30分)-zigzagging order, double stack
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 sequences. And it is a simple standard routine to print the numbers in level-order. However原创 2020-06-22 21:12:49 · 191 阅读 · 0 评论 -
1143 Lowest Common Ancestor (30分)-前序和中序重构二叉树、LCA
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 the following properties:The left subtree of a node co原创 2020-06-21 13:01:25 · 100 阅读 · 0 评论 -
1151 LCA in a Binary Tree (30分)-前序中序重构数、LCA
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 supposed to find their LCA.Input Specification:Each input file contains one test ca原创 2020-06-21 12:41:45 · 94 阅读 · 0 评论 -
1147 Heaps (30分)-Heap、数组
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 than or equal to (in a max heap) or less than or equal to (in a min heap) t..原创 2020-06-20 14:43:44 · 91 阅读 · 0 评论 -
1155 Heap Paths (30分)-Heap、数组
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 than or equal to (in a max heap) or less than or equal to (in a min heap) t..原创 2020-06-20 13:48:53 · 76 阅读 · 0 评论