
PAT甲级刷题
文章平均质量分 75
terter努力学习中|・ω・`)
多读书多看报,少吃零食多睡觉
展开
-
PAT-A1029 Median
A1029 MedianGiven 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原创 2021-10-19 14:28:19 · 199 阅读 · 0 评论 -
PAT-A1044 Shopping in Mars (25 分)
A1044 Shopping in Mars (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 chain can be cut at any position for only once and some of原创 2021-09-28 19:47:17 · 166 阅读 · 0 评论 -
PAT-A1085 Perfect Sequence (完美数列)
A1085 Perfect Sequence (完美数列)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, respectively.Now given a sequence原创 2021-09-27 19:08:40 · 211 阅读 · 0 评论 -
PAT-A1038 Recover the Smallest Number
A1038 Recover the Smallest NumberGiven 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-原创 2021-09-27 17:43:44 · 170 阅读 · 0 评论 -
PAT-A1067 Sort with Swap(0, i)
A1067 Sort with Swap(0, i)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, 2, 1, 3} we may apply the swap o原创 2021-09-26 20:19:06 · 122 阅读 · 0 评论 -
PAT-A1037 Magic Coupon
A1037 Magic CouponThe 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 offe原创 2021-09-26 18:25:35 · 111 阅读 · 0 评论 -
PAT-A1070 Mooncake (结构体+排序)
A1070 Mooncake (结构体+排序)Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region’s culture. Now given the inventory amounts and原创 2021-09-26 17:21:25 · 131 阅读 · 0 评论 -
PAT-A1048 Find Coins (寻找硬币)
A1048 Find Coins (寻找硬币)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. However, there was a special requirement原创 2021-09-25 18:22:40 · 147 阅读 · 0 评论 -
PAT-A1050 String Subtraction (字符串相关的散列)
A1050 String Subtraction (字符串相关的散列)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 given strings. However, it might not be that simple原创 2021-09-25 17:31:33 · 128 阅读 · 0 评论 -
PAT-A1041 Be Unique
A1041 Be UniqueBeing 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 bets on a unique number wins. For example, if the原创 2021-09-25 16:45:05 · 114 阅读 · 0 评论 -
PAT-A1092 To Buy or Not to Buy (买或者不买珠子)
A1092 To Buy or Not to Buy (买或者不买珠子)Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However the owner of the shop would only sell the strings in wh原创 2021-09-25 15:21:46 · 162 阅读 · 0 评论 -
PAT- A1084 Broken Keyboard (旧键盘)
A1084 Broken Keyboard (旧键盘)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 a string that you are supposed to type, and the string that yo原创 2021-09-25 14:37:27 · 96 阅读 · 0 评论 -
PAT-A1083 List Grades
A1083 List GradesGiven a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades are in a given interval.Input Specifi原创 2021-09-24 15:09:24 · 100 阅读 · 0 评论 -
PAT-A1055 The World‘s Richest
A1055 The World’s RichestForbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, but concentrate only on the people in a certain range of ages.原创 2021-09-24 14:46:09 · 161 阅读 · 0 评论 -
PAT-A1028 List Sorting (多种排序条件)
A1028 List Sorting (多种排序条件)Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, the first line contains two integers N (≤105) and C, wher原创 2021-09-20 16:52:27 · 124 阅读 · 0 评论 -
PAT-A1062 Talent and Virtue (德才论)
A1062 Talent and Virtue (德才论)About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people’s talent and virtue. According to his theory, a man being outstanding in both talent and virtue must be a “sage(圣人)”; b原创 2021-09-19 20:54:35 · 154 阅读 · 0 评论 -
PAT-A1082 Read Number in Chinese (中文读数字)
A1082 Read Number in Chinese (中文读数字)Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For example, -123456789 is read as Fu yi Yi er Qian san Bai si Shi wu Wan liu Q原创 2021-09-19 20:43:52 · 111 阅读 · 0 评论 -
PAT-A1077 Kuchiguse
A1077 Kuchiguse (找字符串相同字符串)The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called “Kuchiguse” and is often exa原创 2021-09-18 19:48:39 · 121 阅读 · 0 评论 -
PAT-A1035 Password (密码替换)
A1035 Password (密码替换)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原创 2021-09-18 17:08:23 · 106 阅读 · 0 评论 -
PAT-A1005 Spell It Right (正确拼写)
A1005 Spell It Right (正确拼写)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. Each case occupies one line which原创 2021-09-17 21:22:33 · 129 阅读 · 0 评论 -
PAT-A1001 A+B Format (A+B的格式)
A1001 A+B Format (A+B的格式)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).Input Specification:Each input file contains one test case. Each原创 2021-09-17 20:04:50 · 229 阅读 · 0 评论 -
PAT-A1073 Scientific Notation (科学计数法)
A1073 Scientific Notation (科学计数法)Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [±][1-9].[0-9]+E[±][0-9]+ which means that the integer portion has exactly原创 2021-09-15 21:49:55 · 257 阅读 · 0 评论 -
PAT- A1061 Dating (福尔摩斯的约会)
A1061 Dating (福尔摩斯的约会)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 strings are actually referring to the co原创 2021-09-15 18:11:06 · 107 阅读 · 0 评论 -
PAT-A1058 A+B in Hogwarts (钱币转换)
A1058 A+B in Hogwarts (钱币转换)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 Galleon and twenty-nine Knuts to a Sickle, it’s easy enough.” You原创 2021-09-13 21:25:05 · 115 阅读 · 0 评论 -
PAT- A1027 Colors in Mars
A1027 Colors in Mars (13进制)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原创 2021-09-13 18:29:00 · 98 阅读 · 0 评论 -
PAT-A1019 General Palindromic Number (进制转换+回文串)
A1019 General Palindromic Number (进制转换+回文串)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 p原创 2021-09-13 17:51:55 · 81 阅读 · 0 评论 -
PAT-A1031 Hello World for U
A1031 Hello World for UGiven 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 printed in the original order, starting原创 2021-09-12 21:30:30 · 125 阅读 · 0 评论 -
PAT-A1036 Boys vs Girls (男孩VS女孩)
A1036 Boys vs Girls (男孩VS女孩)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:Each input file contains one test case. Each case contains原创 2021-09-12 21:09:11 · 167 阅读 · 0 评论 -
PAT-A1006 Sign In and Sign Out (最早和最晚)
A1006 Sign In and Sign Out (最早和最晚)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原创 2021-09-12 20:11:16 · 177 阅读 · 0 评论 -
PAT-A1011 World Cup Betting (世界杯赔率)
A1011 World Cup Betting (世界杯赔率)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 bettin原创 2021-09-11 22:50:24 · 773 阅读 · 0 评论 -
PAT-A1009 Product of Polynomials (多项式乘法)
A1009 Product of Polynomials (多项式乘法)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 lines, and each line contains the information of a polynomial:原创 2021-09-11 21:25:18 · 128 阅读 · 0 评论 -
PAT-A1002 A+B for Polynomials (多项式加法)
A1002 A+B for Polynomials (多项式加法)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 lines, and each line contains the information of a polynomial:K原创 2021-09-11 19:30:15 · 221 阅读 · 0 评论 -
PAT-A1065 A+B and C (长整型比较)
A1065 A+B and C (长整型比较)Given three integers A, B and C in (−263,263), you are supposed to tell whether A+B>C.Input Specification:The first line of the input gives the positive number of test cases, T (≤10). Then T test cases follow, each consists of原创 2021-09-10 22:45:35 · 112 阅读 · 0 评论 -
PAT-A1046 Shortest Distance(最短距离)
A1046 Shortest Distance (最短距离)The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file contains one test case. For each原创 2021-09-10 21:18:32 · 164 阅读 · 0 评论 -
PAT甲级备考模板持续整理中。。。
拖了很久,我终于来写了。原创 2021-09-10 19:42:43 · 338 阅读 · 0 评论 -
PAT-A1042 Shuffling Machine (卡片交换)
A1042 Shuffling Machine (卡片交换)Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where employees collaborate with gamblers by performing inadequat原创 2021-09-10 19:30:57 · 95 阅读 · 0 评论