- 博客(90)
- 资源 (12)
- 收藏
- 关注
原创 PAT 甲级 1148 Werewolf - Simple Version
1148Werewolf - Simple Version(20 point(s))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 sai...
2019-02-28 23:45:04 526
原创 PAT 甲级 1147 Heaps
1147Heaps(30 point(s))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 g...
2019-02-28 19:09:50 415
原创 PAT 甲级 1146 Topological Order
1146Topological Order(25 point(s))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 a...
2019-02-28 18:36:09 911 4
原创 PAT 甲级 1145 Hashing - Average Search Time
1145Hashing - Average Search Time(25 point(s))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 inte...
2019-02-28 17:39:29 524 4
原创 PAT 甲级 1144 The Missing Number
1144The Missing Number(20 point(s))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 ...
2019-02-28 16:28:28 391
原创 PAT 甲级 1143 Lowest Common Ancestor
1143Lowest Common Ancestor(30 point(s))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 recu...
2019-02-28 13:14:01 495
原创 PAT 甲级 1142 Maximal Clique
1142Maximal Clique(25 point(s))Acliqueis a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. Amaximal cliqueis a clique that cannot be...
2019-02-28 12:08:35 535
原创 PAT 甲级 1141 PAT Ranking of Institutions
1141PAT Ranking of Institutions(25 point(s))After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the rankli...
2019-02-28 10:27:54 425
原创 PAT 甲级 1140 Look-and-say Sequence
1140Look-and-say Sequence(20 point(s))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 nu...
2019-02-28 09:56:31 418
原创 PAT 甲级 1139 First Contact
1139First Contact(30 point(s))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 ...
2019-02-27 20:27:24 1244 2
原创 PAT 甲级 1138 Postorder Traversal
1138Postorder Traversal(25 point(s))Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the fi...
2019-02-27 18:23:57 405
原创 PAT 甲级 1137 Final Grading
1137Final Grading(25 point(s))For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first o...
2019-02-27 18:05:31 657
原创 PAT 甲级 1136 A Delayed Palindrome
1136 A Delayed Palindrome (20 point(s))Consider a positive integer N written in standard notation with k+1 digits ai as ak⋯a1a0 with 0≤ai<10 for all i and ak>0. Then N is pal...
2019-02-27 12:27:13 405
原创 PAT 甲级 1135 Is It A Red-Black Tree
1135 Is It A Red-Black Tree (30 point(s))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 o...
2019-02-27 11:52:12 548
原创 PAT 甲级 1134 Vertex Cover
1134 Vertex Cover (25 point(s))A vertex cover of a graph is a set of vertices such that each edge of the graph is incident to at least one vertex of the set. Now given a graph with several vertex se...
2019-02-27 00:20:23 406
原创 PAT 甲级 1133 Splitting A Linked List
1133 Splitting A Linked List (25 point(s))Given a singly linked list, you are supposed to rearrange its elements so that all the negative values appear before all of the non-negatives, and all the v...
2019-02-25 18:16:13 474
原创 PAT 甲级 1132 Cut Integer
1132 Cut Integer (20 point(s))Cutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 16...
2019-02-25 17:00:43 347
原创 PAT 甲级 1131 Subway Map
1131 Subway Map (30 point(s))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 s...
2019-02-25 16:24:58 664
原创 PAT 甲级 1130 Infix Expression
1130 Infix Expression (25 point(s))Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting the precedences of the operators.Input S...
2019-02-25 11:18:24 380
原创 PAT 甲级 1129 Recommendation System
1129 Recommendation System (25 point(s))Recommendation system predicts the preference that a user would give to an item. Now you are asked to program a very simple recommendation system that rates t...
2019-02-25 01:10:08 442
原创 PAT 甲级 1128 N Queens Puzzle
1128 N Queens Puzzle (20 point(s))The "eight queens puzzle" is the problem of placing eight chess queens on an 8×8 chessboard so that no two queens threaten each other. Thus, a solution requires tha...
2019-02-24 23:31:33 445
原创 PAT 甲级 1127 ZigZagging on a Tree
1127 ZigZagging on a Tree (30 point(s))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 trav...
2019-02-24 19:11:01 633 2
原创 PAT 甲级 1126 Eulerian Path
1126 Eulerian Path (25 point(s))In graph theory, an Eulerian path is a path in a graph which visits every edge exactly once. Similarly, an Eulerian circuit is an Eulerian path which starts and ends ...
2019-02-24 17:55:01 344 2
原创 PAT 甲级 1125 Chain the Ropes
1125 Chain the Ropes (25 point(s))Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one piece, as sho...
2019-02-24 17:14:42 304
原创 PAT 甲级 1124 Raffle for Weibo Followers
1124 Raffle for Weibo Followers (20 point(s))John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he would select winners from eve...
2019-02-24 16:51:02 261
原创 PAT 甲级 1123 Is It a Complete AVL Tree
1123 Is It a Complete AVL Tree (30 point(s))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 tim...
2019-02-24 12:19:13 434
原创 PAT 甲级 1122 Hamiltonian Cycle
1122 Hamiltonian Cycle (25 point(s))The "Hamilton cycle problem" is to find a simple cycle that contains every vertex in a graph. Such a cycle is called a "Hamiltonian cycle".In this problem, you ...
2019-02-24 11:12:47 379
原创 PAT 甲级 1121 Damn Single
1121 Damn Single (25 point(s))"Damn Single (单身狗)" is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of....
2019-02-24 10:32:17 338
原创 PAT 甲级 1120 Friend Numbers
1120 Friend Numbers (20 point(s))Two integers are called "friend numbers" if they share the same sum of their digits, and the sum is their "friend ID". For example, 123 and 51 are friend numbers sin...
2019-02-24 09:51:48 318
原创 PAT 甲级 1119 Pre- and Post-order Traversals
1119 Pre- and Post-order Traversals (30 point(s))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 in...
2019-02-24 09:42:39 469
原创 PAT 甲级 1118 Birds in Forest
1118 Birds in Forest (25 point(s))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 h...
2019-02-23 23:17:31 391
原创 PAT 甲级 1117 Eddington Number
1117 Eddington Number (25 point(s))British astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an "Eddington number", E -- that is, the max...
2019-02-23 22:28:42 407
原创 PAT 甲级 1116 Come on! Let's C
1116 Come on! Let's C (20 point(s))"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is ...
2019-02-23 18:23:11 281
原创 PAT 甲级 1115 Counting Nodes in a BST
1115 Counting Nodes in a BST (30 point(s))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 ...
2019-02-23 18:10:33 386
原创 PAT 甲级 1114 Family Property
1114 Family Property (25 point(s))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...
2019-02-23 17:26:51 429
原创 PAT 甲级 1113 Integer Set Partition
1113 Integer Set Partition (25 point(s))Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint sets A1 and A2 of n1 and n2 numbers, respectively...
2019-02-23 16:18:08 333
原创 PAT 甲级 1112 Stucked Keyboard
1112 Stucked Keyboard (20 point(s))On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on sc...
2019-02-23 12:22:07 421 2
原创 PAT 甲级 1111 Online Map
1111 Online Map (30 point(s))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 th...
2019-02-23 11:18:30 458 4
原创 PAT 甲级 1110 Complete Binary Tree
1110 Complete Binary Tree (25 point(s))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...
2019-02-23 00:18:39 507 10
原创 PAT 甲级 1109 Group Photo
1109 Group Photo (25 point(s))Formation is very important when taking a group photo. Given the rules of forming K rows with N people as the following: The number of people in each row must be N/K...
2019-02-22 22:51:18 409
LL(1)文法的判别以及非LL(1)文法的转换(完整可运行代码)
2018-09-10
DFA的最小化 (完整可运行代码)
2018-09-10
NFA的确定化(NFA->DFA)(完整可运行代码)
2018-09-10
正规文法转正规式+正规式NFA(完整可运行代码)
2018-09-10
Chomsky文法类型判断(编译原理实验完整代码)
2018-09-10
王道计算机考研机试指南(完整版)
2018-09-10
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人