- 博客(53)
- 收藏
- 关注
原创 PAT 甲级 1055 The World‘s Richest (25分)
题目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 o
2020-07-10 11:50:38
154
原创 PAT 甲级 1054 The Dominant Color (20分)
题目1054 The Dominant Color (20分)Behind the scenes in the computer’s memory, color is always talked about as a series of 24 bits of information for each pixel. In an image, the color with the largest proportional area is called the dominant color. A strict
2020-07-10 11:44:24
141
原创 PAT 甲级 1053 Path of Equal Weight (30分)
题目1053 Path of Equal Weight (30分)Given a non-empty tree with root R, and with weight W**i assigned to each tree node T**i. The weight of a path from *R* to *L* is defined to be the sum of the weights of all the nodes along the path from R to any leaf nod
2020-07-10 11:40:44
119
原创 PAT 甲级 1052 Linked List Sorting (25分)
题目1052 Linked List Sorting (25分)A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list, you a
2020-07-10 11:34:27
124
原创 PAT 甲级 1051 Pop Sequence (25分)
题目1051 Pop Sequence (25分)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
2020-07-10 11:30:55
159
原创 PAT 甲级 1050 String Subtraction (20分)
题目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 simply to calculate S1−S2 for any given strings. However, it might not be that simple to
2020-07-10 11:26:32
162
原创 PAT 甲级 1049 Counting Ones (30分)
题目1049 Counting Ones (30分)The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1’s in 1, 10, 11, and 12.Input S
2020-07-10 11:23:19
91
原创 PAT 甲级 1048 Find Coins (25分)
题目1048 Find Coins (25分)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 requiremen
2020-07-10 10:58:11
98
原创 PAT 甲级 1047 Student List for Course (25分)
题目1047 Student List for Course (25分)Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.Input Specification:Each
2020-07-10 10:52:37
87
原创 PAT 甲级 1046 Shortest Distance (20分)
题目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 Specification:Each input file contains one test case. For eac
2020-07-10 10:46:23
91
原创 PAT 甲级 1045 Favorite Color Stripe (30分)
题目1045 Favorite Color Stripe (30分)Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts together to form he
2020-07-09 22:49:03
101
原创 PAT 甲级 1044 Shopping in Mars (25分)
题目1044 Shopping in Mars (25分)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
2020-07-09 22:11:00
100
原创 PAT 甲级 1043 Is It a Binary Search Tree (25分)
题目1043 Is It a Binary Search Tree (25分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node’s key.The right subtree of a node
2020-07-09 21:53:00
98
原创 PAT 甲级 1042 Shuffling Machine (20分)
题目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 inadequa
2020-07-09 21:37:29
76
原创 PAT 甲级 1041 Be Unique (20分)
题目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 first one who bets on a unique number wins. For example
2020-07-09 21:32:27
99
原创 PAT 甲级 1040 Longest Symmetric String (25分)
题目1040 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 must output 11.I
2020-07-09 21:29:07
95
原创 PAT 甲级 1039 Course List for Student (25分)
题目1039 Course List for Student (25分)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 for a query.Input
2020-07-09 21:26:33
133
原创 PAT 甲级 1038 Recover the Smallest Number (30分)
题目1038 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-87 or 0229-32
2020-07-09 21:15:01
88
原创 PAT 甲级 1037 Magic Coupon (25分)
题目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 the value of that product back! What is more, the shop a
2020-07-09 21:02:54
108
原创 PAT 甲级 1036 Boys vs Girls (25分)
题目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
2020-07-09 20:54:54
66
原创 PAT 甲级 1035 Password (20分)
题目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 distinguish 1 (one) from l (L in lowercase), or 0 (zero) from O
2020-07-09 20:50:56
105
原创 PAT 甲级 1034 Head of a Gang (30分)
题目1034 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 the total time length of all
2020-07-09 19:45:09
53
原创 PAT 甲级 1033 To Fill or Not to Fill (25分)
题目1033 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 gas station may give
2020-07-09 19:37:20
107
原创 PAT 甲级 1032 Sharing (25分)
题目1032 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, loading and being are stored as s
2020-07-09 19:30:22
90
原创 PAT 甲级 1031 Hello World for U (20分)
题目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, the characters must be printed in the original order,
2020-07-09 19:24:20
102
原创 PAT 甲级 1030 Travel Plan (30分)
题目1030 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 between his/her starting city a
2020-07-09 19:18:22
75
原创 PAT 甲级 1029 Median (25分)
题目1029 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 15. The median of two sequences is
2020-07-06 13:52:44
112
原创 PAT 甲级 1028 List Sorting (25分)
题目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 integers N (≤105) and C, where
2020-07-06 13:45:16
73
原创 PAT 甲级 1027 Colors in Mars (20分)
题目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 for Red, the middle 2 digits for Green, and the last
2020-07-06 13:37:21
74
原创 PAT 甲级 1025 PAT Ranking (25分)
题目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 afte
2020-07-06 13:32:10
80
原创 PAT 甲级 1024 Palindromic Number (25分)
题目1024 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.Non-palindromic numbe
2020-07-06 13:25:25
86
原创 PAT 甲级 1023 Have Fun with Numbers (20分)
题目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 happens to be another 9-digit number consisting exactly the
2020-07-06 13:21:14
61
原创 PAT甲级 1022 Digital Library (30分)
题目1022 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 as its ID. Given any query
2020-07-06 13:15:15
116
原创 PAT 甲级 1021 Deepest Root (25分)
题目1021 Deepest Root (25分)A graph which is connected and acyclic can be considered a tree. The height 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 is called the deepest root.I
2020-07-06 13:07:33
87
原创 PAT 甲级 1020 Tree Traversals (25分)
题目1020 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 corresponding binary tree.In
2020-07-06 11:01:54
118
原创 PAT 甲级 1019 General Palindromic Number (20分)
题目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 single digit numbers are palindromic numbers.Although pali
2020-07-06 10:56:44
71
原创 PAT 甲级 1018 Public Bike Management (30分)
题目1018 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 city.The Public Bi
2020-07-03 14:32:33
100
原创 PAT 甲级 1017 Queueing at Bank (25分)
题目1017 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 line, until it is his/her t
2020-07-03 14:15:23
80
原创 PAT 甲级 1016 Phone Bills (25分)
题目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
2020-07-03 14:06:44
91
原创 PAT 甲级 1015 Reversible Primes (20分)
题目1015 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 prime.Now given any two p
2020-07-03 13:53:17
70
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人