![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
文章平均质量分 73
ryo_218
要努力成为别人的依赖呀!
展开
-
PAT 1152 Google Recruitment (20)
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 co...原创 2019-03-01 17:56:57 · 169 阅读 · 0 评论 -
PAT 1013 Battle Over Cities (25)
1013 Battle Over Cities (25)(25 分)It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed...原创 2018-09-01 17:20:37 · 113 阅读 · 0 评论 -
PAT 1002 A+B for Polynomials (25)
1002 A+B for Polynomials (25)(25 分)This time, you are supposed to find A+B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 line...原创 2018-08-29 22:17:45 · 132 阅读 · 0 评论 -
PAT 1036 Boys vs Girls (25)
1036 Boys vs Girls (25)(25 分)This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specification:...原创 2018-09-04 13:41:50 · 87 阅读 · 0 评论 -
PAT 1034 Head of a Gang (30)
1034 Head of a Gang (30)(30 分)One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight ...原创 2018-09-04 13:24:32 · 119 阅读 · 0 评论 -
PAT 1010 Radix (25)
1010 Radix (25)(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 and 110 is a binary number.Now for an...原创 2018-08-31 20:48:36 · 206 阅读 · 0 评论 -
PAT 1004 Counting Leaves (30)
1004 Counting Leaves (30)(30 分)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 contain...原创 2018-08-28 22:09:14 · 122 阅读 · 0 评论 -
PAT 1009 Product of Polynomials (25)
1009 Product of Polynomials (25)(25 分)This time, you are supposed to find A×B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 l...原创 2018-08-30 22:40:53 · 117 阅读 · 0 评论 -
PAT 1003 Emergency (25)
1003 Emergency (25)(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 connected by some roads. Amount of rescue t...原创 2018-08-30 21:50:43 · 228 阅读 · 0 评论 -
PAT 1096 Consecutive Factors (20)
1096 Consecutive Factors (20)(20 分)Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3*5*6*7, where 5, 6, and 7 are the ...原创 2018-08-17 18:08:51 · 139 阅读 · 0 评论 -
PAT 1088 Rational Arithmetic (20)
1088 Rational Arithmetic (20)(20 分)For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:...原创 2018-08-17 15:02:26 · 131 阅读 · 0 评论 -
PAT 1084 Broken Keyboard (20)
1084 Broken Keyboard (20)(20 分)On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given ...原创 2018-08-17 12:49:45 · 110 阅读 · 0 评论 -
PAT 1007 Maximum Subsequence Sum (25)
1007 Maximum Subsequence Sum (25)(25 分)Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1 <= i <= j <= K. The Maximu...原创 2018-08-17 12:13:44 · 84 阅读 · 0 评论 -
PAT 1090 Highest Price in Supply Chain (25)
1090 Highest Price in Supply Chain (25)(25 分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer....原创 2018-08-08 22:07:18 · 152 阅读 · 0 评论 -
PAT 1120 Friend Numbers (20)
1120 Friend Numbers (20)(20 分)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 since ...原创 2018-08-08 17:42:14 · 113 阅读 · 0 评论 -
PAT 1037 Magic Coupon (25)
1037 Magic Coupon (25)(25 分)The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N tim...原创 2018-09-04 17:47:40 · 143 阅读 · 0 评论 -
PAT 1038 Recover the Smallest Number (30)
1038 Recover the Smallest Number (30)(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 re...原创 2018-09-04 19:01:55 · 108 阅读 · 0 评论 -
PAT 1040 Longest Symmetric String (25)
1040 Longest Symmetric String (25)(25 分)Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric...原创 2018-09-04 20:56:03 · 122 阅读 · 0 评论 -
PAT 1086 Tree Traversals Again (25)
1086 Tree Traversals Again (25)(25 分)An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbe...原创 2018-09-06 22:28:07 · 140 阅读 · 0 评论 -
PAT 1111 Online Map (30)
1111 Online Map (30)(30 分)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 the o...原创 2018-09-06 21:35:43 · 142 阅读 · 0 评论 -
PAT 1087 All Roads Lead to Rome (30)
1087 All Roads Lead to Rome (30)(30 分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most...原创 2018-09-06 18:10:38 · 264 阅读 · 0 评论 -
PAT 1150 Travelling Salesman Problem (25)
1150 Travelling Salesman Problem (25) (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...原创 2018-09-09 21:11:28 · 152 阅读 · 0 评论 -
PAT 1149 Dangerous Goods Packaging (25)
1149 Dangerous Goods Packaging (25) (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...原创 2018-09-09 20:44:36 · 231 阅读 · 0 评论 -
PAT 1148 Werewolf - Simple Version (20)
1148 Werewolf - Simple Version (20) (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:...原创 2018-09-09 17:26:28 · 1093 阅读 · 0 评论 -
PAT 1029 Median (25)
1029 Median (25)(25 分)Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S2 = ...原创 2018-09-03 21:04:24 · 98 阅读 · 0 评论 -
PAT 1021 Deepest Root (25)
1021 Deepest Root (25)(25 分)A graph which is connected and acyclic can be considered a tree. The hight of the tree depends on the selected root. Now you are supposed to find the root that results in...原创 2018-09-03 16:17:20 · 91 阅读 · 0 评论 -
PAT 1045 Favorite Color Stripe (30)
1045 Favorite Color Stripe (30)(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 unwante...原创 2018-09-05 13:27:18 · 123 阅读 · 0 评论 -
PAT 1044 Shopping in Mars (25)
1044 Shopping in Mars (25)(25 分)Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment, the...原创 2018-09-05 10:54:08 · 111 阅读 · 0 评论 -
PAT 1151 LCA in a Binary Tree (30)
1151 LCA in a Binary Tree (30) (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, ...原创 2018-09-11 12:34:37 · 276 阅读 · 2 评论 -
PAT 1043 Is It a Binary Search Tree (25)
1043 Is It a Binary Search Tree (25)(25 分)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 ...原创 2018-09-02 21:18:10 · 128 阅读 · 0 评论 -
PAT 1030 Travel Plan (30)
1030 Travel Plan (30)(30 分)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 ...原创 2018-09-02 20:21:58 · 114 阅读 · 0 评论 -
PAT 1018 Public Bike Management (30)
1018 Public Bike Management (30)(30 分)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...原创 2018-09-02 16:45:42 · 134 阅读 · 0 评论 -
PAT 1113 Integer Set Partition (25)
1113 Integer Set Partition (25)(25 分)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. Let S1 an...原创 2018-08-08 17:13:10 · 101 阅读 · 0 评论 -
PAT 1027 Colors in Mars (20)
1027 Colors in Mars (20)(20 分)People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digi...原创 2018-08-08 16:50:31 · 158 阅读 · 0 评论 -
PAT 1099 Build A Binary Search Tree (30)
1099 Build A Binary Search Tree (30)(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 ...原创 2018-08-06 21:52:59 · 225 阅读 · 0 评论 -
PAT 1056 Mice and Rice (25)
1056 Mice and Rice (25)(25 分)Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of ea...原创 2018-08-06 21:10:23 · 119 阅读 · 0 评论 -
PAT 1006 Sign In and Sign Out (25)
1006 Sign In and Sign Out (25)(25 分)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the ...原创 2018-08-10 22:04:44 · 133 阅读 · 0 评论 -
PAT 1065 A+B and C (64bit) (20)
1065 A+B and C (64bit) (20)(20 分)Given three integers A, B and C in [-2^63^, 2^63^], you are supposed to tell whether A+B > C.Input Specification:The first line of the input gives the positiv...原创 2018-08-10 21:26:05 · 81 阅读 · 0 评论 -
PAT 1061 Dating (20)
1061 Dating (20)(20 分)Sherlock Holmes received a note with some strange strings: "Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm". It took him only a minute to figure out ...原创 2018-08-10 21:05:05 · 105 阅读 · 0 评论 -
PAT 1035 Password (20)
1035 Password (20)(20 分)To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to dist...原创 2018-08-10 17:49:48 · 107 阅读 · 0 评论