
用Python刷PAT (Advanced Level) Practice
文章平均质量分 58
记录用Python刷PAT甲级题目。
D_ry
Don't repeat yourself.
展开
-
PAT (Advanced Level) Practice python解法合集
1001 A+B Format1002 A+B for Polynomials1003 Emergency1004 Counting Leaves1005 Spell It Right1006 Sign In and Sign Out1007 Maximum Subsequence Sum1008 Elevator1009 Product of Polynomials1010 R...原创 2019-01-07 13:46:36 · 1029 阅读 · 0 评论 -
PAT 1012 The Best Rank python解法
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 Lin...原创 2020-04-06 20:58:16 · 597 阅读 · 0 评论 -
PAT 1009 Product of Polynomials python解法
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 informati...原创 2020-04-05 19:30:58 · 597 阅读 · 0 评论 -
PAT 1071 Speech Patterns python解法
1071 Speech Patterns (25 分)People often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “the cops”. Analyzing such patterns can h...原创 2019-02-19 17:22:40 · 362 阅读 · 0 评论 -
PAT 1077 Kuchiguse python解法
1077 Kuchiguse (20 分)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...原创 2019-01-30 15:46:43 · 274 阅读 · 0 评论 -
PAT 1061 Dating python解法
1061 Dating (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 that th...原创 2019-01-30 14:34:17 · 331 阅读 · 0 评论 -
PAT 1108 Finding Average python解法
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 that some of the input numbers might not be le...原创 2019-01-29 17:36:07 · 223 阅读 · 0 评论 -
PAT 1144 The Missing Number python解法
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. For ...原创 2019-01-29 15:31:17 · 228 阅读 · 0 评论 -
PAT 1112 Stucked Keyboard python解法
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 those keys will appear repeatedly on screen for...原创 2019-01-28 17:11:58 · 283 阅读 · 0 评论 -
PAT 1152 Google Recruitment python解法
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 con...原创 2019-01-21 16:11:21 · 273 阅读 · 2 评论 -
PAT 1132 Cut Integer python解法
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 ...原创 2019-01-21 10:44:00 · 320 阅读 · 2 评论 -
PAT 1081 Rational Sum python解法
1081 Rational Sum (20 分)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 sta...原创 2019-01-20 17:18:24 · 270 阅读 · 0 评论 -
PAT 1046 Shortest Distance python解法
1046 Shortest Distance (20 分)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 Specific...原创 2019-01-20 00:06:59 · 358 阅读 · 0 评论 -
PAT 1035 Password python解法
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 distingui...原创 2019-01-19 21:07:06 · 245 阅读 · 0 评论 -
PAT 1100 Mars Numbers python解法
1100 Mars Numbers (20 分)People on Mars count their numbers with base 13:Zero on Earth is called “tret” on Mars.The numbers 1 to 12 on Earch is called “jan, feb, mar, apr, may, jun, jly, aug, sep, o...原创 2019-01-18 22:02:05 · 271 阅读 · 0 评论 -
PAT 1136 A Delayed Palindrome python解法
1136 A Delayed Palindrome (20 分)Consider a positive integer N written in standard notation with k+1 digits ai as aki ⋯a1 a0 with 0 ≤ ai < 10 for all i and ak > 0. Then N is pa...原创 2019-01-16 11:50:54 · 244 阅读 · 0 评论 -
PAT 1019 General Palindromic Number python解法
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 singl...原创 2019-01-16 11:15:31 · 256 阅读 · 0 评论 -
PAT 1104 Sum of Number Segments python解法
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...原创 2019-01-15 13:51:48 · 278 阅读 · 0 评论 -
PAT 1069 The Black Hole of Numbers python解法
1069 The Black Hole of Numbers (20 分)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,...原创 2019-01-13 21:09:53 · 291 阅读 · 0 评论 -
PAT 1073 Scientific Notation python解法
1073 Scientific Notation (20 分)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...原创 2019-01-13 19:30:54 · 303 阅读 · 0 评论 -
PAT 1023 Have Fun with Numbers python解法
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 happen...原创 2019-01-12 21:04:53 · 454 阅读 · 0 评论 -
PAT 1005 Spell It Right python解法
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.Input Specification:Each input file co...原创 2019-01-12 17:00:09 · 303 阅读 · 0 评论 -
PAT 1031 Hello World for U python解法
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:h de ll rlowoThat is, ...原创 2019-01-11 17:44:43 · 318 阅读 · 0 评论 -
PAT 1116 Come on! Let's C python解法
1116 Come on! Let’s C (20 分)“Let’s C” is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun,...原创 2019-01-10 21:03:25 · 241 阅读 · 2 评论 -
python刷PAT超时怎么办
1.优化代码,降低复杂度2.有一些python内置函数比较耗时,尝试换一种方式, 比如求a集合是不是b集合的父集可以转换为求b集合是不是a集合的子集,(将a.issuperset(b)转换为b.issubset(a))3.删掉中文...原创 2019-01-09 22:23:22 · 870 阅读 · 0 评论 -
PAT 1149 Dangerous Goods Packaging python解法
1149 Dangerous Goods Packaging (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 troub...原创 2019-01-09 22:17:05 · 295 阅读 · 0 评论 -
PAT 1050 String Subtraction python解法
1050 String Subtraction (20 分)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 si...原创 2019-01-09 09:59:15 · 311 阅读 · 0 评论 -
PAT 1037 Magic Coupon python解法
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 th...原创 2019-01-09 09:36:35 · 307 阅读 · 0 评论 -
PAT 1124 Raffle for Weibo Followers python解法
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...原创 2019-01-08 21:07:23 · 219 阅读 · 0 评论 -
PAT 1063 Set Similarity python解法
1063 Set Similarity (25 分)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 i...原创 2019-01-08 15:42:24 · 247 阅读 · 0 评论 -
PAT 1042 Shuffling Machine python解法
1042 Shuffling Machine (20 分)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 empl...原创 2019-01-08 13:59:14 · 341 阅读 · 0 评论 -
PAT 1058 A+B in Hogwarts python解法
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 Galleon an...原创 2019-01-08 10:15:14 · 273 阅读 · 0 评论 -
PAT 1041 Be Unique python解法
1041 Be Unique (20 分)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 ...原创 2019-01-07 19:48:51 · 262 阅读 · 0 评论 -
PAT 1084 Broken Keyboard python解法
1084 Broken Keyboard (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 a stri...原创 2019-01-07 16:15:20 · 258 阅读 · 0 评论 -
PAT 1006 Sign In and Sign Out python解法
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 recor...原创 2019-01-07 15:37:58 · 308 阅读 · 0 评论 -
PAT 1125 Chain the Ropes python解法
1125 Chain the Ropes (25 分)Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one piece, as shown by th...原创 2019-01-07 14:47:44 · 157 阅读 · 0 评论 -
PAT 1120 Friend Numbers python解法
1120 Friend Numbers (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 1+2+3...原创 2019-01-07 11:50:43 · 217 阅读 · 0 评论 -
PAT 1092 To Buy or Not to Buy python解法
1092 To Buy or Not to Buy (20 分)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...原创 2019-01-07 11:36:16 · 177 阅读 · 0 评论 -
PAT 1027 Colors in Mars python解法
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 ar...原创 2019-01-07 11:21:36 · 220 阅读 · 0 评论 -
PAT 1083 List Grades python解法
1083 List Grades (25 分)Given 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 reco...原创 2019-01-07 11:09:01 · 247 阅读 · 0 评论