
PAT甲级
Bourbon_Whiskey_
这个作者很懒,什么都没留下…
展开
-
PAT-A1003 Emergency 题目内容及题解
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 l...原创 2019-02-01 11:55:38 · 739 阅读 · 0 评论 -
PAT-A1004 Counting Leaves 题目内容及题解
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Each case starts...原创 2019-02-01 11:55:50 · 760 阅读 · 0 评论 -
PAT-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. Eac...原创 2019-02-01 11:56:01 · 337 阅读 · 0 评论 -
PAT-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...原创 2019-02-01 11:56:13 · 325 阅读 · 0 评论 -
PAT-A1007 Maximum Subsequence Sum 题目内容及题解
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj } where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequen...原创 2019-02-01 11:56:27 · 432 阅读 · 0 评论 -
PAT-A1008 Elevator 题目内容及题解
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 sec...原创 2019-02-01 11:56:39 · 620 阅读 · 0 评论 -
PAT-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 informa...原创 2019-02-01 11:57:05 · 360 阅读 · 0 评论 -
PAT-A1010 Radix 题目内容及题解
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 inte...原创 2019-02-01 11:57:15 · 513 阅读 · 0 评论 -
PAT-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. Si...原创 2019-02-01 11:57:23 · 415 阅读 · 0 评论 -
PAT-A1012 The Best Rank 题目内容及题解
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 - Eng...原创 2019-02-01 11:57:33 · 556 阅读 · 0 评论 -
PAT-A1013 Battle Over Cities 题目内容及题解
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 nee...原创 2019-02-01 11:57:44 · 393 阅读 · 0 评论 -
PAT-A1014 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 s...原创 2019-02-01 11:57:55 · 415 阅读 · 0 评论 -
PAT-A1015 Reversible Primes 题目内容及题解
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 pr...原创 2019-02-01 11:58:07 · 348 阅读 · 0 评论 -
PAT-A1016 Phone Bills 题目内容及题解
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...原创 2019-02-01 11:58:18 · 506 阅读 · 0 评论 -
PAT-A1017 Queueing at Bank 题目内容及题解
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 li...原创 2019-02-01 11:58:31 · 446 阅读 · 0 评论 -
PAT-A1018 Public Bike Management 题目内容及题解
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 ...原创 2019-02-01 11:58:43 · 2297 阅读 · 0 评论 -
PAT-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...原创 2019-02-01 11:59:14 · 411 阅读 · 0 评论 -
PAT-A1020 Tree Traversals 题目内容及题解
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 cor...原创 2019-02-01 11:59:23 · 362 阅读 · 0 评论 -
PAT-A1021 Deepest Root 题目内容及题解
A graph which is connected and acyclic can be considered a tree. The hight 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 i...原创 2019-02-01 11:59:31 · 1843 阅读 · 0 评论 -
PAT-A1022 Digital Library 题目内容及题解
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 a...原创 2019-02-01 11:59:40 · 469 阅读 · 0 评论 -
PAT-A1023 Have Fun with Numbers 题目内容及题解
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 con...原创 2019-02-01 11:59:49 · 2027 阅读 · 0 评论 -
PAT-A1024 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...原创 2019-02-01 11:59:58 · 445 阅读 · 0 评论 -
PAT-A1025 PAT Ranking 题目内容及题解
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 w...原创 2019-02-01 12:00:07 · 471 阅读 · 0 评论 -
PAT-A1026 Table Tennis 题目内容及题解
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 ava...原创 2019-02-01 12:00:17 · 918 阅读 · 0 评论 -
PAT-A1027 Colors in Mars 题目内容及题解
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 dig...原创 2019-02-01 12:00:28 · 294 阅读 · 0 评论 -
PAT-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...原创 2019-02-01 12:00:39 · 231 阅读 · 0 评论 -
PAT-A1029 Median 题目内容及题解
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...原创 2019-02-01 12:00:57 · 506 阅读 · 0 评论 -
PAT-A1030 Travel Plan 题目内容及题解
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 b...原创 2019-02-01 15:42:15 · 488 阅读 · 0 评论 -
PAT-A1031 Hello World for U 题目内容及题解
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 mus...原创 2019-02-01 15:42:23 · 415 阅读 · 0 评论 -
PAT-A1032 Sharing 题目内容及题解
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,...原创 2019-02-01 15:42:32 · 353 阅读 · 0 评论 -
PAT-A1033 To Fill or Not to Fill 题目内容及题解
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. Different ga...原创 2019-02-01 15:42:40 · 449 阅读 · 0 评论 -
PAT-A1034 Head of a Gang 题目内容及题解
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 t...原创 2019-02-01 15:42:48 · 483 阅读 · 0 评论 -
PAT-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 ...原创 2019-02-01 23:53:17 · 546 阅读 · 0 评论 -
PAT-A1036 Boys vs Girls 题目内容及题解
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 t...原创 2019-02-01 23:53:26 · 464 阅读 · 0 评论 -
PAT-A1037 Magic Coupon 题目内容及题解
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 b...原创 2019-02-01 23:53:35 · 344 阅读 · 1 评论 -
PAT-A1038 Recover the Smallest Number 题目内容及题解
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...原创 2019-02-01 23:53:49 · 270 阅读 · 0 评论 -
PAT-A1039 Course List for Student 题目内容及题解
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 ...原创 2019-02-01 23:53:58 · 309 阅读 · 0 评论 -
PAT-A1040 Longest Symmetric String 题目内容及题解
Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence you ...原创 2019-02-02 10:17:14 · 443 阅读 · 0 评论 -
PAT-A1041 Be Unique 题目内容及题解
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,10^4]. The first one who bets ...原创 2019-02-02 10:18:40 · 366 阅读 · 1 评论 -
PAT-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 gambler...原创 2019-02-02 10:41:17 · 434 阅读 · 0 评论