- 博客(28)
- 收藏
- 关注
原创 1051. Pop Sequence (25)-PAT甲级真题
Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, if M is 5 and N is 7, we can obta
2022-08-06 23:50:21
165
原创 Palindromic Number (25)-PAT甲级真题
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.Non-palindromic numbers can be paired with palindromic
2022-07-08 19:56:22
107
原创 Have Fun with Numbers (20)-PAT甲级真题
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 consisting exactly the numbers from 1 to 9, only in a diffe
2022-07-08 18:01:25
95
原创 1096. Consecutive Factors (20)-PAT甲级真题
Among all the factors of a positive integer N, there may exist several consecutive numbers. For example, 630 can be factored as 3×5×6×7, where 5, 6, and 7 are the three consecutive numbers. Now given any positive N, you are supposed to find the maximum num
2022-07-08 16:58:07
125
原创 1088. Rational Arithmetic (20)-PAT甲级真题
For two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Each input file contains one test case, which gives in one line the two rational numbers in the format . The numera
2022-07-06 13:42:43
125
原创 1081. Rational Sum (20)-PAT甲级真题
Given N rational numbers in the form , you are supposed to calculate their sum.Each input file contains one test case. Each case starts with a positive integer N (≤100), followed in the next line N rational numbers where all the numerators and denominator
2022-07-06 02:32:36
99
原创 1059. Prime Factors (25)-PAT甲级真题
Given any positive integer N, you are supposed to find all of its prime factors, and write them in the format N = p1k1×p2k2×⋯×pmkm.Each input file contains one test case which gives a positive integer N in the range of long int.Factor N in the format
2022-07-02 11:05:40
136
原创 1069. The Black Hole of Numbers (20)-PAT甲级真题
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, a new number can be obtained by taking the second number from the first one. Repeat in this m
2022-06-29 02:58:41
108
原创 1101. Quick Sort (25)-PAT甲级真题
There is a classical process named partition in 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. Given N
2022-06-28 15:11:16
150
原创 1029. Median (25)-PAT甲级真题
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 15. The median of two sequences is defined to be the me
2022-06-28 13:26:58
127
原创 1089. Insert or Merge (25)-PAT甲级真题
According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and
2022-06-27 22:42:04
144
原创 1044. Shopping in Mars (25)-PAT甲级真题
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 the diamonds are taken off the
2022-06-27 00:56:12
181
原创 1085. Perfect Sequence (25)-PAT甲级真题
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 and a parameter p, you are sup
2022-06-25 19:00:12
105
原创 1037. Magic Coupon (25)-PAT甲级真题
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 back! What is more, the shop also offers some bonus produ
2022-06-25 02:36:41
140
原创 1033. To Fill or Not to Fill (25)-PAT甲级真题
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 gas station may give different price. You are asked to car
2022-06-24 22:34:20
156
原创 1070. Mooncake (25)-PAT甲级真题
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 the prices of all kinds
2022-06-24 15:04:03
112
原创 1048. Find Coins (25)-PAT甲级真题
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 of the payment: for eac
2022-06-23 21:39:26
156
原创 1092. To Buy or Not to Buy (20)-PAT甲级真题
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 whole pieces. Hence Eva must check whet
2022-06-23 16:54:59
138
原创 1084. Broken Keyboard (20)-PAT甲级试题
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 you actually type out, please l
2022-06-22 13:14:46
109
原创 1080. Graduate Admission (30)-PAT甲级真题
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 two grade
2022-06-21 21:50:19
152
原创 1075. PAT Judge (25)-PAT甲级真题
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.Each input file contains one test case. For each case, the first line contains 3 positive integers
2022-06-21 16:00:49
86
原创 1028 List Sorting(25)
Excel can sort records according to any column. Now you are supposed to imitate this function.Each input file contains one test case. For each case, the first line contains two integers N (≤105) and C, where N is the number of records and C is the column t
2022-06-20 12:18:28
128
1
原创 1025. PAT Ranking (25)-PAT甲级真题
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 is your
2022-06-20 03:01:23
108
原创 1016. Phone Bills (25)-PAT甲级真题
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 call, the ti
2022-06-20 02:12:21
150
1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅