![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
xiao1guaishou
这个作者很懒,什么都没留下…
展开
-
PAT A1066 Root of AVL Tree (25 分)
题目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 time they differ by more than one, rebalanci...原创 2019-07-31 19:56:20 · 125 阅读 · 0 评论 -
PAT A1069
题目:For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by ...原创 2019-04-09 11:46:36 · 245 阅读 · 0 评论 -
PAT A1081
题目:Given N rational numbers in the form numerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive...原创 2019-04-15 16:28:18 · 172 阅读 · 0 评论 -
PAT A1049
题目:The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N being 12, there are five ...原创 2019-04-12 00:15:36 · 167 阅读 · 0 评论 -
PAT A1101
题目:There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less than the pivot are moved to i...原创 2019-04-08 17:03:16 · 138 阅读 · 0 评论 -
PAT A1093
题目:The string APPAPT contains two PAT’s as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters....原创 2019-04-08 13:20:32 · 66 阅读 · 0 评论 -
PAT A1089
题目:According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input ...原创 2019-04-08 11:49:06 · 186 阅读 · 0 评论 -
PAT A1010
题目: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 any pair of positive...原创 2019-04-07 16:39:52 · 141 阅读 · 0 评论 -
PAT A1029
题目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 = { 9, 10, 15, 16, 17 ...原创 2019-04-07 16:10:58 · 181 阅读 · 0 评论 -
PAT A1044
题目: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 chain can be cut at any pos...原创 2019-04-06 13:34:13 · 323 阅读 · 0 评论 -
PAT A1085
题目:Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the maximum and minimum numbers in the sequence, res...原创 2019-04-06 10:55:40 · 136 阅读 · 1 评论 -
PAT A1048
题目:Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. How...原创 2019-04-01 13:22:58 · 141 阅读 · 0 评论 -
PAT A1033
题目:With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Differe...原创 2019-04-05 11:53:08 · 318 阅读 · 0 评论 -
PAT A1067
题目:Given any permutation of the numbers {0, 1, 2,…, N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, 0...原创 2019-04-04 17:36:19 · 411 阅读 · 1 评论 -
PAT A1008
题目: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 specified order. It costs ...原创 2019-04-09 13:57:36 · 133 阅读 · 0 评论 -
PAT A1010
题目: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 segments: (0.1) (0.1, 0.2) (0.1, 0.2...原创 2019-04-09 14:39:41 · 157 阅读 · 0 评论 -
PAT A1107 Social Clusters (30 分)
题目:When register on a social network, you are always asked to specify your hobbies in order to find some potential friends with the same hobbies. A social cluster is a set of people who have some of...原创 2019-08-03 23:09:28 · 148 阅读 · 0 评论 -
PAT1099 Build A Binary Search Tree (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 the node’s key.The right...原创 2019-07-28 23:49:12 · 78 阅读 · 0 评论 -
PAT A1047
题目:Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.Inp...原创 2019-04-20 16:41:34 · 242 阅读 · 0 评论 -
PAT A1051
题目Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, …, N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of...原创 2019-04-29 12:13:31 · 136 阅读 · 0 评论 -
PAT A1022
题目:A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit num...原创 2019-04-28 20:12:02 · 189 阅读 · 0 评论 -
PAT A1024
题目: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 single digit numbers are palindromic nu...原创 2019-04-19 12:27:04 · 396 阅读 · 0 评论 -
PAT A1096
题目: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 three consecutive numbers. Now g...原创 2019-04-19 00:50:49 · 154 阅读 · 0 评论 -
PAT A1054
题目:Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called ...原创 2019-04-22 18:46:39 · 97 阅读 · 0 评论 -
PAT A1100
题目:People on Mars count their numbers with base 13:Zero on Earth is called “tret” on Mars.The numbers 1 to 12 on Earth is called “jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec” on Ma...原创 2019-04-22 16:36:32 · 113 阅读 · 0 评论 -
PAT A1060
题目:If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×105 with simple chopping. Now given the number of s...原创 2019-04-22 11:34:33 · 216 阅读 · 0 评论 -
PAT A1063
题目:Given two sets of integers, the similarity of the sets is defined to be Nc/Nt×100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total numbe...原创 2019-04-21 11:37:22 · 89 阅读 · 0 评论 -
PAT A1088
题目:For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each input file contains one te...原创 2019-04-16 11:05:10 · 102 阅读 · 0 评论 -
PAT A1037
题目: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 times the value of that prod...原创 2019-04-03 16:39:26 · 103 阅读 · 0 评论 -
PAT A1050
题目:Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1−S2 for any gi...原创 2019-03-31 11:53:47 · 73 阅读 · 0 评论 -
PAT A1041
题目:Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,104]. The first one who b...原创 2019-03-31 10:49:01 · 80 阅读 · 0 评论 -
PAT A1038
题目: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 recover many numbers such like 32-321-3214...原创 2019-04-04 15:29:08 · 342 阅读 · 1 评论 -
PAT 1005
题目: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 file contains one test case....原创 2019-03-11 19:44:58 · 86 阅读 · 0 评论 -
PAT A1078
题目:The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be H(key)=key...原创 2019-03-20 10:20:46 · 149 阅读 · 0 评论 -
PAT A1061
题目: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 that those strange st...原创 2019-03-11 13:04:34 · 134 阅读 · 0 评论 -
PAT 1058
题目:1058 A+B in Hogwarts (20 分)If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a Gall...原创 2019-03-10 21:49:54 · 101 阅读 · 0 评论 -
PAT A1027
题目: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 digits are for Red, the middle ...原创 2019-03-10 21:31:55 · 65 阅读 · 0 评论 -
PAT A1019
题目: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 single digit numbers are palindromic nu...原创 2019-03-10 20:50:11 · 82 阅读 · 0 评论 -
PAT A1067
题目:Given any permutation of the numbers {0, 1, 2,…, N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, 0...原创 2019-03-14 22:20:10 · 75 阅读 · 0 评论 -
PAT A1031
题目:Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as:h de ll rlowoThat is, the characters must be pr...原创 2019-03-10 17:18:13 · 89 阅读 · 0 评论