
PAT甲级
小·幸·运
你的所有努力最后都会回赠予你。
展开
-
PAT甲级A1001 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).InputEach input file contains...原创 2018-07-16 21:27:16 · 228 阅读 · 0 评论 -
PAT甲级A1002 A+B for Polynomials (25)
This time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polyn...原创 2018-07-16 22:13:01 · 160 阅读 · 0 评论 -
PAT甲级A1074 Reversing Linked List (25)
Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, given L being 1→2→3→4→5→6, if K = 3, then you must output 3→2→1→6→5→4; if K ...原创 2018-07-23 22:18:42 · 319 阅读 · 0 评论 -
PAT甲级A1003 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 l...原创 2018-07-18 22:31:47 · 295 阅读 · 0 评论 -
PAT甲级A1007 Maximum Subsequence Sum (25)
Given a sequence of K integers { N~1~, N~2~, ..., N~K~ }. A continuous subsequence is defined to be { N~i~, N~i+1~, ..., N~j~ } where 1 <= i <= j <= K. The Maximum Subsequence is the continuo...原创 2018-07-24 23:12:09 · 223 阅读 · 0 评论 -
PAT甲级A1004 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.InputEach input file contains one test case. Each case starts with a line co...原创 2018-07-19 21:35:21 · 179 阅读 · 0 评论 -
PAT甲级A1005 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 contains one test case. Eac...原创 2018-07-19 21:56:30 · 158 阅读 · 0 评论 -
PAT甲级A1006 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...原创 2018-07-19 22:17:57 · 151 阅读 · 0 评论 -
PAT甲级A1008 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 sec...原创 2018-07-25 20:27:37 · 158 阅读 · 0 评论 -
PAT甲级A1013 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 nee...原创 2018-07-28 20:49:30 · 443 阅读 · 0 评论 -
PAT甲级A1009 Product of Polynomials (25)
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...原创 2018-07-25 21:28:49 · 127 阅读 · 0 评论 -
PAT甲级A1073 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 in...原创 2018-07-20 22:15:07 · 143 阅读 · 0 评论 -
PAT甲级A1014 Waiting in Line (30)
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...原创 2018-07-29 16:21:24 · 184 阅读 · 0 评论 -
PAT甲级A1010 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 in...原创 2018-07-26 21:19:55 · 305 阅读 · 0 评论 -
PAT甲级A1011 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. Si...原创 2018-07-26 22:15:19 · 221 阅读 · 0 评论 -
PAT甲级A1017 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 li...原创 2018-08-03 21:32:14 · 176 阅读 · 0 评论 -
PAT甲级A1015 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 pr...原创 2018-07-30 22:25:19 · 136 阅读 · 0 评论 -
PAT甲级A1012 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 Algebra), and E - Eng...原创 2018-07-27 22:11:30 · 172 阅读 · 0 评论 -
PAT甲级A1018 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 ...原创 2018-08-06 22:21:03 · 263 阅读 · 0 评论 -
PAT甲级A1024 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...原创 2018-08-14 21:17:49 · 162 阅读 · 0 评论 -
PAT甲级A1025 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 w...原创 2018-08-14 22:15:56 · 127 阅读 · 0 评论 -
PAT甲级A1022 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 a...原创 2018-08-11 21:25:21 · 154 阅读 · 0 评论 -
PAT甲级A1016 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...原创 2018-08-02 20:20:42 · 413 阅读 · 0 评论 -
PAT甲级A1019 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...原创 2018-08-07 21:31:45 · 137 阅读 · 0 评论 -
PAT甲级A1020 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 cor...原创 2018-08-07 22:28:58 · 158 阅读 · 0 评论 -
PAT甲级A1029 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...原创 2018-08-17 22:06:22 · 662 阅读 · 0 评论 -
PAT甲级A1027 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 dig...原创 2018-08-15 22:04:14 · 131 阅读 · 0 评论 -
PAT甲级A1023 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 con...原创 2018-08-13 21:45:13 · 166 阅读 · 0 评论 -
PAT甲级A1030 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 b...原创 2018-08-18 20:31:46 · 165 阅读 · 0 评论 -
PAT甲级A1031 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, the characters must be...原创 2018-08-18 21:54:53 · 166 阅读 · 0 评论 -
PAT甲级A1028 List Sorting (25)
Excel can sort records according to any column. Now you are supposed to imitate this function.InputEach input file contains one test case. For each case, the first line contains two integers N (&l...原创 2018-08-16 21:19:47 · 179 阅读 · 0 评论 -
PAT甲级A1033 To Fill or Not to Fill (25)
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...原创 2018-08-22 21:48:02 · 275 阅读 · 0 评论 -
PAT甲级A1037 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 b...原创 2018-08-27 21:17:40 · 178 阅读 · 0 评论 -
PAT甲级A1040 Longest Symmetric String(25 分)
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 ...原创 2018-08-30 21:28:51 · 212 阅读 · 0 评论 -
PAT甲级A1032 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,...原创 2018-08-20 22:17:57 · 200 阅读 · 0 评论 -
PAT甲级A1038 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...原创 2018-08-28 21:31:08 · 197 阅读 · 0 评论 -
PAT甲级A1041 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 first one who bets o...原创 2018-08-31 21:15:10 · 159 阅读 · 0 评论 -
PAT甲级A1042 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 gambler...原创 2018-08-31 21:56:41 · 232 阅读 · 0 评论 -
PAT甲级A1034 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 t...原创 2018-08-24 21:17:37 · 168 阅读 · 0 评论 -
PAT甲级A1035 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 ...原创 2018-08-24 22:11:19 · 238 阅读 · 0 评论