![](https://img-blog.csdnimg.cn/20190927151026427.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
PAT编程
文章平均质量分 74
分享一下PAT甲级的考试和经验
编程龙
这个作者很懒,什么都没留下…
展开
-
2021年秋季PAT甲级满分题解与分析
第一题题目描述Let’s design a data structure A that combines arrays and linked lists as the following:At the very beginning, an integer array A0 of length L0 is initialized for the user. When the user tries to access the ith element A[i], if 0≤i<L0 , then A[原创 2021-09-12 17:00:50 · 1231 阅读 · 4 评论 -
PAT甲级 1001 A+B Format (20 分)
PAT甲级 1001 A+B Format (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).输入Each input file contains one test case. Each case cont原创 2021-08-22 16:11:42 · 75 阅读 · 0 评论 -
PAT 甲级1002 A+B for Polynomials (25 分)
题目描述This time, you are supposed to find A+B where A and B are two polynomials(多项式).输入Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial:K,N1,aN1,...,Nk,aNk K,N_1 ,a_{N_1}, ...,N_k,原创 2021-08-22 16:35:58 · 61 阅读 · 0 评论 -
PAT 甲级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 connected by some roads. Amount of rescue teams in each city and the length of each road between any pair of cities are m原创 2021-08-22 17:21:04 · 67 阅读 · 0 评论 -
PAT 甲级 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.输入Each input file contains one test case. Each case starts with a line containing 0<N<100, the number of nodes in a tree, a原创 2021-08-22 17:39:29 · 75 阅读 · 0 评论 -
PAT 甲级 1005 Spell It Right (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.输入Each input file contains one test case. Each case occupies one line which contains an N (<=10100)<=10^{100})原创 2021-08-22 19:52:07 · 68 阅读 · 0 评论 -
PAT 甲级 1006 Sign In and Sign Out (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 records of signing in’s and out’s, you are supposed to find the ones who have unlocked an原创 2021-08-22 20:00:42 · 70 阅读 · 0 评论 -
PAT 甲级 1007 Maximum Subsequence Sum (25 分)
题目描述Given a sequence of K integers { N1,N2...NkN_1,N_2...N_kN1,N2...Nk} . A continuous subsequence is defined to be { Ni,Ni+1,...NjN_i,N_{i+1},...N_jNi,Ni+1,...Nj} where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the la原创 2021-08-22 20:55:22 · 100 阅读 · 0 评论 -
PAT 甲级 1008 Elevator (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 specified order. It costs 6 seconds to move the elevator up one floor, and 4 secon原创 2021-08-22 21:03:22 · 84 阅读 · 0 评论 -
PAT 甲级 1009 Product of Polynomials (25 分)
题目描述This time, you are supposed to find A×B where A and B are two polynomials.输入Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial:K,N1,aN1,N2,aN2,...,Nk,aNkK,N_1,a_{N1},N_2,a_{N2},原创 2021-08-23 10:42:58 · 66 阅读 · 0 评论 -
PAT 甲级 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 and 110 is a binary number.Now for any pair of positive integers N1N_1N1and N2N_2N2 , your task is to find the原创 2021-08-23 14:10:22 · 79 阅读 · 0 评论 -
PAT 甲级 1011 World Cup Betting (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 World Cup trophy in South Africa. Similarly, football betting fans were putting their m原创 2021-08-23 14:31:02 · 71 阅读 · 0 评论 -
PAT 甲级 1012 The Best Rank (25 分)
题目描述To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At the mean time, we encourage students by em原创 2021-08-23 14:57:58 · 287 阅读 · 0 评论 -
PAT 甲级 1013 Battle Over Cities (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. We must know immediately if we need to repair any other highways to keep the rest of原创 2021-08-23 15:20:23 · 60 阅读 · 0 评论 -
PAT 甲级 1014 Waiting in Line
题目描述Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The space inside the yellow line in front of each window is e原创 2021-08-23 16:37:14 · 46 阅读 · 0 评论 -
PAT 甲级 1015 Reversible Primes (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 because its reverse 37 is also a prime.Now given any two positive integers N (<105原创 2021-08-23 16:49:07 · 56 阅读 · 0 评论 -
PAT 甲级 1016 Phone Bills (25 分)
题目描述A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. When a customer starts connecting a long-distance call,原创 2021-08-24 11:11:51 · 83 阅读 · 0 评论 -
PAT 甲级 1017 Queueing at Bank (25 分)
题目描述Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow line, until it is his/her turn to be served and there原创 2021-08-24 11:50:36 · 57 阅读 · 0 评论 -
PAT 甲级 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 world. One may rent a bike at any station and return it to any other stations in the city.The Public Bike Management Center (PBMC) keep原创 2021-08-24 14:49:33 · 56 阅读 · 0 评论 -
PAT 甲级 1019 General Palindromic Number (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 single digit numbers are palindromic numbers.Although palindromic numbers are most often consi原创 2021-08-24 15:21:49 · 81 阅读 · 0 评论 -
PAT 甲级 1020 Tree Traversals (25 分)
题目描述Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the corresponding binary tree.输入Each input file contains原创 2021-08-24 15:55:09 · 82 阅读 · 0 评论 -
PAT 甲级 1021 Deepest Root (25 分)
题目描述A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is called the deepest root.输入Each input file cont原创 2021-08-24 21:36:44 · 103 阅读 · 0 评论 -
PAT 甲级 1022 Digital Library (30 分)
题目描述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 number as its ID. Given any query from a reader, you are su原创 2021-08-24 23:18:14 · 58 阅读 · 0 评论 -
PAT 甲级 1023 Have Fun with Numbers (20 分)
题目描述Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number consisting exactly the numbers from 1 to 9, only in a原创 2021-08-24 23:22:54 · 106 阅读 · 0 评论 -
PAT 甲级 1024 Palindromic Number (25 分)
题目描述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 numbers.Non-palindromic numbers can be paired with palind原创 2021-08-24 23:31:47 · 64 阅读 · 0 评论 -
PAT 甲级 1025 PAT Ranking (25 分)
题目描述Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediately after the test. Now it is原创 2021-08-25 21:35:08 · 81 阅读 · 0 评论 -
PAT 甲级 1026 Table Tennis (30 分)
题目描述A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open when they arrive, they will be assigned to the available table with the smallest number. If all the t原创 2021-08-27 19:42:18 · 145 阅读 · 0 评论 -
PAT 甲级 1027 Colors in Mars (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 digits are for Red, the middle 2 digits for Green, and the last 2 digits for Blue. The原创 2021-08-27 19:44:38 · 125 阅读 · 0 评论 -
PAT 甲级 1028 List Sorting (25 分)
题目描述Excel can sort records according to any column. Now you are supposed to imitate this function.输入Each input file contains one test case. For each case, the first line contains two integers N (≤105≤10^5≤105) and C, where N is the number of records and原创 2021-08-27 20:01:32 · 74 阅读 · 0 评论 -
PAT甲级 1029 Median (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 = { 9, 10, 15, 16, 17 } is 15. The median of two sequences is defined to be t原创 2021-08-27 20:19:35 · 71 阅读 · 0 评论 -
PAT 甲级 1030 Travel Plan (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 to decide the shortest path between his/her starting city and the destination. I原创 2021-08-27 21:11:15 · 78 阅读 · 0 评论 -
PAT 甲级 1031 Hello World for U (20 分)
题目描述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:That is, the characters must be printed in the original order, starting top-down from the left vertical line w原创 2021-08-27 21:21:31 · 83 阅读 · 0 评论 -
PAT 甲级 1032 Sharing (25 分)
题目描述To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example, loading and being are stored as showed in Figure 1原创 2021-08-27 21:34:38 · 75 阅读 · 0 评论 -
PAT 甲级 1033 To Fill or Not to Fill (25 分)
题目描述Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediately after the test. Now it is原创 2021-08-28 13:42:58 · 74 阅读 · 0 评论 -
PAT 甲级 1034 Head of a Gang (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 of a relation is defined to be the total time length of all the phone calls made be原创 2021-08-28 15:23:43 · 89 阅读 · 0 评论 -
PAT 甲级 1035 Password (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 distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O (o in uppercase).原创 2021-08-28 15:26:18 · 74 阅读 · 0 评论 -
PAT 甲级 1036 Boys vs Girls (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.输入Each input file contains one test case. Each case contains a positive integer N, followed by N lines原创 2021-08-28 15:28:21 · 90 阅读 · 0 评论 -
PAT 甲级 1037 Magic Coupon (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 times the value of that product back! What is more, the shop also offers some bonus原创 2021-08-29 13:22:11 · 107 阅读 · 0 评论 -
PAT 甲级 1038 Recover the Smallest Number (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 recover many numbers such like 32-321-3214-0229-87 or 0229-32-87-321-3214 with respect to differen原创 2021-08-29 13:27:36 · 78 阅读 · 0 评论 -
PAT 甲级 1039 Course List for Student (25 分)
题目描述Zhejiang University has 40000 students and provides 2500 courses. Now given the student name lists of all the courses, you are supposed to output the registered course list for each student who comes for a query.输入Each input file contains one test c原创 2021-08-29 13:54:24 · 70 阅读 · 0 评论