- 博客(9)
- 资源 (1)
- 收藏
- 关注
原创 PAT Advanced—1143 Lowest Common Ancestor (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.A binary search tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node cont
2020-07-13 23:45:57 123
原创 PAT Advanced—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 than or equal to (in a max heap) or less than or equal to (in a min heap) t
2020-07-08 21:15:52 150
原创 PAT Advanced—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 supposed to find their LCA.Input Specification:Each input file contains one test case.
2020-07-08 20:06:50 162
原创 PAT Advanced—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 possible route that visits each city and returns to the origin city?” It is an NP-hard problem in com
2020-07-07 00:16:18 148
原创 PAT Advanced—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 trouble. For example, oxidizing agent (氧化剂) must not be packed with flammable liquid (易燃液体), or it
2020-07-05 23:45:45 205
原创 PAT Advanced—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: “Player #2 is a werewolf.”;player #2 said: “Player #3 is a human.”;player #3 said: “Player #4 is a
2020-07-05 00:39:31 214
原创 PAT Advanced—1155 Heap Paths (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 than or equal to (in a max heap) or less than or equal to (in a min heap) t
2020-07-03 23:27:49 123
原创 PAT Advanced—1154 Vertex Coloring (25分)
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-coloring.Now you are supposed to tell if a given color
2020-07-02 22:44:13 131
原创 PAT Advanced—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 basic;the 2nd - 4th digits are the test site number, ranged from 101 to 999;the 5th - 10th digits give
2020-07-01 22:17:33 121
PDF password remove.rar
2020-04-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人