
PAT甲级真题练习
SourDumplings
当个愉快的软件攻城狮
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
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 (i...原创 2019-01-18 09:19:36 · 127 阅读 · 0 评论 -
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...原创 2019-01-18 09:20:53 · 142 阅读 · 0 评论 -
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 nu...原创 2019-01-18 09:21:59 · 396 阅读 · 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...原创 2019-01-18 09:23:14 · 227 阅读 · 0 评论 -
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.In...原创 2019-01-18 09:24:26 · 114 阅读 · 0 评论 -
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 retu...原创 2019-01-18 09:25:32 · 179 阅读 · 0 评论 -
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 (氧化剂)...原创 2019-01-18 09:26:49 · 210 阅读 · 0 评论 -
1118. Birds in Forest (25)
时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueSome scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belo...原创 2019-01-23 20:45:36 · 132 阅读 · 0 评论 -
1117. Eddington Number(25)
时间限制250 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueBritish astronomer Eddington liked to ride a bike. It is said that in order to show off his skill, he has even defined an ...原创 2019-01-23 20:52:19 · 392 阅读 · 0 评论 -
1116. Come on! Let's C (20)
时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, Yue"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang Univ...原创 2019-01-23 20:53:25 · 149 阅读 · 0 评论 -
1115 Counting Nodes in a BST (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 or equal to the node's key. ...原创 2019-01-23 20:55:44 · 126 阅读 · 0 评论 -
1114. Family Property (25)
时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to help us collect the data for family-owned property. Given each person's family members, and...原创 2019-01-23 20:56:37 · 198 阅读 · 0 评论 -
1113. Integer Set Partition (25)
时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a set of N (> 1) positive integers, you are supposed to partition them into two disjoint sets A1 and A2 of n1 and...原创 2019-01-23 20:57:50 · 149 阅读 · 0 评论 -
1112. Stucked Keyboard (20)
时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueOn a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding t...原创 2019-01-23 20:59:13 · 169 阅读 · 0 评论 -
1111. Online Map (30)
时间限制300 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueInput our current position and a destination, an online map can recommend several paths. Now your job is to recommend two ...原创 2019-01-23 21:00:28 · 235 阅读 · 0 评论 -
1110. Complete Binary Tree (25)
时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains on...原创 2019-01-23 21:01:27 · 141 阅读 · 0 评论 -
1109. Group Photo (25)
时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueFormation is very important when taking a group photo. Given the rules of forming K rows with N people as the following:...原创 2019-01-24 19:58:37 · 196 阅读 · 0 评论 -
1108. Finding Average (20)
时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated...原创 2019-01-24 20:04:06 · 223 阅读 · 0 评论 -
1107. Social Clusters (30)
时间限制1000 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueWhen register on a social network, you are always asked to specify your hobbies in order to find some potential friends w...原创 2019-01-24 20:07:40 · 139 阅读 · 0 评论 -
1106. Lowest Price in Supply Chain (25)
时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueA supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a produ...原创 2019-01-24 20:09:02 · 160 阅读 · 0 评论 -
1105. Spiral Matrix (25)
时间限制150 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral mat...原创 2019-01-24 20:10:02 · 163 阅读 · 0 评论 -
1104. Sum of Number Segments (20)
时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CAO, PengGiven a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequenc...原创 2019-01-24 20:11:05 · 167 阅读 · 0 评论 -
1103. Integer Factorization (30)
时间限制1200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe K-P factorization of a positive integer N is to write N as the sum of the P-th power of K positive integers. You are ...原创 2019-01-24 20:11:59 · 282 阅读 · 0 评论 -
1102. Invert a Binary Tree (25)
时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you ca...原创 2019-01-24 20:12:53 · 137 阅读 · 0 评论 -
1101. Quick Sort (25)
时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CAO, PengThere is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one e...原创 2019-01-24 20:14:03 · 128 阅读 · 0 评论 -
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...原创 2019-01-20 14:00:42 · 163 阅读 · 0 评论 -
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 (i...原创 2019-01-20 14:01:44 · 193 阅读 · 0 评论 -
1146 Topological Order (25 分)
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-01-20 14:02:55 · 214 阅读 · 0 评论 -
1145 Hashing - Average Search Time (25 分)
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-01-20 14:03:51 · 153 阅读 · 0 评论 -
1144 The Missing Number (20 分)
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-01-20 14:04:47 · 254 阅读 · 0 评论 -
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 ...原创 2019-01-20 14:07:28 · 153 阅读 · 0 评论 -
1142 Maximal Clique (25 分)
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-01-20 14:08:10 · 193 阅读 · 0 评论 -
1141 PAT Ranking of Institutions (25 分)
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-01-20 14:10:27 · 145 阅读 · 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, ...where D is in [0, 9] except 1. The (n+1)st number is a kind of description of the nth n...原创 2019-01-20 14:12:04 · 152 阅读 · 0 评论 -
1139 First Contact (30 分)
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-01-20 14:13:17 · 189 阅读 · 0 评论 -
1138 Postorder Traversal (25 分)
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 first number of the postorder traversal se...原创 2019-01-21 13:24:43 · 168 阅读 · 0 评论 -
1137 Final Grading (25 分)
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 obtain no less than 200 points from...原创 2019-01-21 13:27:01 · 183 阅读 · 0 评论 -
1136 A Delayed Palindrome (20 分)
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 palindromic if and only if ai=ak−i for...原创 2019-01-21 13:28:25 · 136 阅读 · 0 评论 -
1135 Is It A Red-Black Tree (30 分)
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-01-21 13:31:31 · 214 阅读 · 0 评论 -
1134 Vertex Cover (25 分)
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 sets, you are supposed to tell if e...原创 2019-01-21 13:32:30 · 210 阅读 · 0 评论