
PAT甲级
快活书生
人生就像一次星际旅行,旅途中会遇到很多耀眼的星星,你可以选择努力与摘下一颗耀眼的明星,虽然这颗明星代表不了你的一生,但你的星途会因为那些你努力摘下的星星而更加璀璨!
展开
-
1134 Vertex Cover(vector)
声明:本文改写自柳婼的一篇博文。 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...原创 2018-08-14 15:36:02 · 215 阅读 · 0 评论 -
1124 Raffle for Weibo Followers(20 分)
1124 Raffle for Weibo Followers(20 分)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 every N foll...转载 2018-08-27 21:07:13 · 249 阅读 · 0 评论 -
1120 Friend Numbers(20 分)
不是自己做的,优快云现在不让转载,只能复制了,标明出处:https://www.liuchuo.net/archives/29011120 Friend Numbers(20 分)Two integers are called “friend numbers” if they share the same sum of their digits, and the sum is their...转载 2018-08-27 21:26:01 · 168 阅读 · 0 评论 -
1116. Come on! Let’s C (20)
不是自己做的,优快云现在不让转载,只能复制了,标明出处:https://www.liuchuo.net/archives/2476Come on! Let’s C (20) “Let’s C” is a popular and fun programming contest hosted by the College of Computer Science and Technology,...转载 2018-08-28 20:35:28 · 180 阅读 · 0 评论 -
1112. Stucked Keyboard (20)
标明出处: https://www.liuchuo.net/archives/2075 1112. Stucked Keyboard (20) On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to t...转载 2018-08-28 21:29:14 · 130 阅读 · 0 评论 -
1108. Finding Average (20)
标明出处: https://www.liuchuo.net/archives/1924 1108. Finding Average (20) The basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is ...转载 2018-08-28 21:54:49 · 182 阅读 · 0 评论 -
1104 Sum of Number Segments(20 分)
1104 Sum of Number Segments(20 分)Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we have 10 segmen...原创 2018-08-29 15:58:46 · 1028 阅读 · 1 评论 -
1123 Is It a Complete AVL Tree(AVL树)
标明出处:https://www.liuchuo.net/archives/27321123 Is It a Complete AVL Tree(30 分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node ...转载 2018-09-07 19:31:36 · 170 阅读 · 0 评论 -
1003 Emergency(Dijkstra)
标明出处:https://www.liuchuo.net/archives/2359 1003 Emergency(25 分)As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities conn...转载 2018-09-05 08:37:09 · 146 阅读 · 0 评论 -
1004 Counting Leaves(dfs)
标明出处:https://www.liuchuo.net/archives/2229 1004 Counting Leaves(30 分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input ...转载 2018-09-05 10:19:33 · 126 阅读 · 0 评论 -
1007. Maximum Subsequence Sum (最大连续子序列和、动态规划dp)
标明出处:https://www.liuchuo.net/archives/2122 1007. Maximum Subsequence Sum (最大连续子序列和、动态规划dp)Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, ...转载 2018-09-05 10:43:26 · 465 阅读 · 0 评论 -
1010 Radix(二分)
标明出处:https://www.liuchuo.net/archives/2458 1010 Radix(25 分)Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number ...转载 2018-09-05 11:47:47 · 158 阅读 · 0 评论 -
1147 Heaps(30 分)
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 t...原创 2018-08-15 16:46:40 · 275 阅读 · 0 评论 -
1013 Battle Over Cities(连通分量个数,dfs)
参考博客:https://blog.youkuaiyun.com/qq_33913037/article/details/71213985?locationNum=1&fps=1 https://www.liuchuo.net/archives/2346 1013 Battle Over Cities(25 分)It is vitally important to have all the c...转载 2018-09-06 17:00:41 · 324 阅读 · 0 评论 -
1128 N Queens Puzzle(20 分)
1128 N Queens Puzzle(20 分)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 that no two...原创 2018-08-27 20:27:58 · 246 阅读 · 0 评论 -
1142 Maximal Clique(25 分)
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 extende...原创 2018-08-22 09:38:04 · 195 阅读 · 0 评论 -
1138 Postorder Traversal(二叉树前序中序转后序)
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 numb...原创 2018-08-14 08:54:12 · 195 阅读 · 0 评论 -
1137 Final Grading(map,重载运算符)
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...原创 2018-08-14 11:38:02 · 177 阅读 · 0 评论 -
1133 Splitting A Linked List(25 分)
声明:本文在博主柳婼的文章基础上做了修改。 原文链接:https://blog.youkuaiyun.com/liuchuo/article/details/78037305 1133 Splitting A Linked List(25 分)Given a singly linked list, you are supposed to rearrange its elements so that a...转载 2018-08-22 15:26:41 · 253 阅读 · 2 评论 -
1136 A Delayed Palindrome(JAVA)
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...原创 2018-08-19 21:40:04 · 275 阅读 · 0 评论 -
1132 Cut Integer(JAVA)
1132 Cut Integer(20 分)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 = 167 and B ...原创 2018-08-20 17:10:29 · 196 阅读 · 0 评论 -
1001 A+B Format (20)(JAVA)
1001 A+B Format (20)(20 分)Calculate a + b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Inpu...原创 2018-08-20 17:14:59 · 191 阅读 · 0 评论 -
1005 Spell It Right (20)(JAVA)
1005 Spell It Right (20)(20 分)Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input ...原创 2018-08-20 17:15:47 · 258 阅读 · 0 评论 -
1008 Elevator (20)(JAVA)
1008 Elevator (20)(20 分)The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in speci...原创 2018-08-20 17:16:26 · 172 阅读 · 0 评论 -
1011 World Cup Betting (20)(JAVA)
1011 World Cup Betting (20)(20 分)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 W...原创 2018-08-20 17:17:10 · 187 阅读 · 0 评论 -
1015 Reversible Primes (20)(JAVA)
1015 Reversible Primes (20)(20 分)A reversible prime in any number system is a prime whose “reverse” in that number system is also a prime. For example in the decimal system 73 is a reversible prime ...原创 2018-08-20 17:17:49 · 204 阅读 · 0 评论 -
1019 General Palindromic Number (20)(JAVA)
1019 General Palindromic Number (20)(20 分)A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All ...原创 2018-08-20 17:18:37 · 182 阅读 · 0 评论 -
1146 Topological Order(25 分)
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 suppo...原创 2018-08-20 17:19:57 · 520 阅读 · 0 评论 -
1145 Hashing - Average Search Time(25 分)
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...原创 2018-08-20 17:21:18 · 290 阅读 · 0 评论 -
1144 The Missing Number(JAVA)
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. Fo...原创 2018-08-20 17:22:21 · 188 阅读 · 1 评论 -
1018 Public Bike Management(Dijkstra + dfs)
部分内容引用自: https://www.liuchuo.net/archives/2373 1018 Public Bike Management(30 分)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the w...原创 2018-09-07 13:11:42 · 155 阅读 · 0 评论