PAT甲级
猫的旅途
开始一场算法的旅行吧!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
1101 Quick Sort (25分)
测试地址:☞There is a classical process namedpartitionin 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 its left and those larger than the pivot to its right...原创 2020-11-15 15:08:32 · 294 阅读 · 0 评论 -
1001 A+B Format (20分)
Calculatea+band 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 case contains a pair o..原创 2020-06-02 22:46:57 · 166 阅读 · 0 评论 -
1002 A+B for Polynomials (25分)
测试地址:☞This time, you are supposed to findA+BwhereAandBare 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:KN1aN1N2a...原创 2020-07-09 22:52:02 · 396 阅读 · 0 评论 -
1005 Spell It Right (20分)
Given a non-negative integerN, your task is to compute the sum of all the digits ofN, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Each case occupies one line which contains anN(≤10^100...原创 2020-06-02 23:18:10 · 118 阅读 · 0 评论 -
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原创 2020-07-13 00:08:59 · 166 阅读 · 0 评论 -
1008 Elevator (20分)
The highest building in our city has only one elevator. A request list is made up withNpositive 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 seconds to..原创 2020-06-22 18:27:52 · 362 阅读 · 0 评论 -
1009 Product of Polynomials (25分)
This time, you are supposed to findA×BwhereAandBare 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:KN1aN1N2aN2...原创 2020-07-10 15:42:04 · 185 阅读 · 0 评论 -
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 money原创 2020-06-22 19:01:51 · 182 阅读 · 0 评论 -
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), andE- English. At the mean time, we encourage students by...原创 2020-11-01 17:23:34 · 181 阅读 · 0 评论 -
1015 Reversible Primes (20分)
Areversible primein 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 integersN(<105)...原创 2020-06-22 20:17:37 · 166 阅读 · 0 评论 -
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 ca原创 2020-11-02 21:05:33 · 211 阅读 · 0 评论 -
1017 Queueing at Bank (25分)
测试地址:☞Suppose a bank hasKwindows 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 th..原创 2020-07-10 18:03:42 · 206 阅读 · 0 评论 -
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原创 2020-11-05 17:32:32 · 157 阅读 · 0 评论 -
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 forRed, the middle 2 digits forGreen, and the last 2 digits forBlue. T...原创 2020-07-17 15:51:57 · 152 阅读 · 0 评论 -
1028 List Sorting (25分)
测试地址:☞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 integersN(≤105) andC, whereNis the numb...原创 2020-11-15 14:46:46 · 158 阅读 · 0 评论 -
1031 Hello World for U (20分)
测试地址:☞Given any string ofN(≥5) characters, you are asked to form the characters into the shape ofU. For example,helloworldcan be printed as:h de ll rlowoThat is, the characters must be printed in the original order, starting top-down fro...原创 2020-07-17 15:06:09 · 143 阅读 · 0 评论 -
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 distinguish1(one) froml(Lin lowercase), or0(zero) fromO(oin uppercas...原创 2020-07-24 16:05:18 · 153 阅读 · 0 评论 -
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.Input Specification:Each input file contains one test case. Each case contains a positive integer.原创 2020-07-14 09:08:21 · 187 阅读 · 0 评论 -
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 employees collaborate with gamblers by performing inadequate shuffles, many casinos employ原创 2020-07-12 10:03:54 · 167 阅读 · 0 评论 -
1046 Shortest Distance (20分)
测试地址:☞The task is really simple: givenNexits 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 case, the first line..原创 2020-07-08 19:02:55 · 117 阅读 · 0 评论 -
1051 Pop Sequence (25分)
测试地址:☞Given a stack which can keepMnumbers at most. PushNnumbers in the order of 1, 2, 3, ...,Nand pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, ifMis 5 andNis 7, we ...原创 2020-07-12 11:19:28 · 255 阅读 · 0 评论 -
1055 The World‘s Richest (25分)
测试地址:☞Forbes 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. That is, given the原创 2020-11-10 18:10:17 · 171 阅读 · 0 评论 -
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 and twenty-nine Knuts to a Sickle, it's easy enough." Your job is to write a原创 2020-07-17 16:20:31 · 138 阅读 · 0 评论 -
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 those strange strings are actually referring to the coded timeThursd..原创 2020-07-24 17:30:46 · 174 阅读 · 0 评论 -
1062 Talent and Virtue (25分)
测试地址:☞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(圣人)"; being less excellent bu原创 2020-11-01 19:06:59 · 225 阅读 · 0 评论 -
1065 A+B and C (64bit) (20分)
测试地址:☞Given three integersA,BandCin [−2^63,2^63], you are supposed to tell whetherA+B>C.Input Specification:The first line of the input gives the positive number of test cases,T(≤10). ThenTtest cases follow, each consists of a sing...原创 2020-07-12 11:55:08 · 144 阅读 · 0 评论 -
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-9]+ which means that the integer portion has exactly one digit, there is at l原创 2020-08-19 17:37:17 · 218 阅读 · 0 评论 -
1075 PAT Judge (25分)
1075PAT Judge(25分)The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input file contains one test case. For each ...原创 2020-11-03 19:50:27 · 175 阅读 · 0 评论 -
1080 Graduate Admission (30分)
测试地址:☞It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admission procedure.Each applicant will have to provide原创 2020-11-10 18:22:30 · 150 阅读 · 0 评论 -
1083 List Grades (25分)
测试地址:☞Given a list ofNstudent 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 Specification:..原创 2020-11-05 17:53:31 · 176 阅读 · 0 评论 -
1105 Spiral Matrix (25分)
测试地址:☞This time your job is to fill a sequence ofNpositive integers into aspiral matrixin non-increasing order. A spiral matrix is filled in from the first element at the upper-left corner, then move in a clockwise spiral. The matrix hasmrows andn...原创 2020-07-12 23:25:32 · 231 阅读 · 0 评论 -
1113 Integer Set Partition (25分)
测试地址:☞Given a set ofN(>1) positive integers, you are supposed to partition them into two disjoint setsA1andA2ofn1andn2numbers, respectively. LetS1andS2denote the sums of all the numbers inA1andA2, respectively....原创 2020-11-01 19:47:22 · 147 阅读 · 0 评论 -
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 the figure. The resulting chain will be treated as another segment of rope and原创 2020-11-03 20:29:29 · 146 阅读 · 0 评论 -
1141 PAT Ranking of Institutions (25分)
测试地址:☞After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist.Input Specification:Each input file contains one test case. For each case, the first line原创 2020-11-10 16:46:29 · 159 阅读 · 0 评论 -
1146 Topological Order (25分)
测试地址:☞This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supposed to write a program to test each of the options.Input Specification:E原创 2020-11-05 19:48:18 · 147 阅读 · 0 评论
分享