![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT-甲级
文章平均质量分 81
爱写bug的小程序
这个作者很懒,什么都没留下…
展开
-
1154 Vertex Coloring
题目来源:PAT (Advanced Level) PracticeA proper vertex coloring is a labeling of the graph's vertices with colors such that no two vertices sharing the same edge have the same color. A coloring using at most k colors is called a (proper) k-coloring.Now you原创 2021-08-20 21:40:58 · 111 阅读 · 0 评论 -
1155 Heap Paths
题目来源:PAT (Advanced Level) PracticeIn computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater than or equal to (in a max heap) or les原创 2021-08-20 20:43:46 · 89 阅读 · 0 评论 -
1116 Come on! Let‘s C
题目来源:PAT (Advanced Level) Practice"Let's C" is a popular and fun programming contest hosted by the College of Computer Science and Technology, Zhejiang University. Since the idea of the contest is for fun, the award rules are funny as the following:0、原创 2021-08-13 11:37:36 · 126 阅读 · 0 评论 -
1110 Complete Binary Tree
题目来源:PAT (Advanced Level) PracticeGiven a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a positive integer N (≤20) which is the total num原创 2021-08-13 10:42:55 · 120 阅读 · 0 评论 -
1108 Finding Average
题目来源:PAT (Advanced Level) PracticeThe basic task is simple: given N real numbers, you are supposed to calculate their average. But what makes it complicated is that some of the input numbers might not be legal. A legal input is a real number in [−1000,10原创 2021-08-12 17:26:50 · 147 阅读 · 0 评论 -
1075 PAT Judge
题目来源:PAT (Advanced Level) PracticeThe 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原创 2021-08-12 16:11:58 · 135 阅读 · 0 评论 -
1078 Hashing
题目来源:PAT (Advanced Level) PracticeThe task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be H(key)=key%TSize where TSize is the原创 2021-08-11 18:59:50 · 127 阅读 · 0 评论 -
1091 Acute Stroke
题目来源:PAT (Advanced Level) PracticeOne important factor to identify acute stroke (急性脑卒中) is the volume of the stroke core. Given the results of image analysis in which the core regions are identified in each MRI slice, your job is to calculate the volume原创 2021-08-11 17:32:54 · 100 阅读 · 0 评论 -
1088 Rational Arithmetic
题目来源:PAT (Advanced Level) PracticeFor two rational numbers, your task is to implement the basic arithmetics, that is, to calculate their sum, difference, product and quotient.Input Specification:Each input file contains one test case, which gives in原创 2021-08-11 14:01:20 · 100 阅读 · 0 评论 -
1039 Course List for Student (25 分)
题目来源:PAT (Advanced Level) PracticeZhejiang 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原创 2021-08-10 11:48:45 · 98 阅读 · 0 评论 -
1074 Reversing Linked List
题目来源:PAT (Advanced Level) PracticeGiven 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=4, you must output 4→3原创 2021-08-09 12:45:04 · 89 阅读 · 0 评论 -
1097 Deduplication on a Linked List
题目来源:PAT (Advanced Level) PracticeGiven a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K, only the first node of which the value or absolute value of its原创 2021-08-09 11:43:28 · 82 阅读 · 0 评论 -
1052 Linked List Sorting
题目来源:PAT (Advanced Level) PracticeA 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原创 2021-08-08 23:11:10 · 131 阅读 · 0 评论 -
1032 Sharing
题目来源:PAT (Advanced Level) PracticeTo 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 a原创 2021-08-08 20:49:03 · 121 阅读 · 0 评论 -
1100 Mars Numbers
题目来源:PAT (Advanced Level) PracticePeople on Mars count their numbers with base 13:Zero on Earth is called "tret" on Mars. The numbers 1 to 12 on Earth is called "jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec" on Mars, respectively. For t原创 2021-08-08 11:51:05 · 151 阅读 · 0 评论 -
1055 The World‘s Richest
题目来源:PAT (Advanced Level) PracticeForbes 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原创 2021-08-02 09:19:56 · 66 阅读 · 0 评论 -
1014 Waiting in Line
题目来源:PAT (Advanced Level) PracticeSuppose 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 inside the yellow l原创 2021-08-01 13:16:07 · 97 阅读 · 0 评论 -
1017 Queueing at Bank
题目来源:PAT (Advanced Level) PracticeSuppose 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/原创 2021-07-31 12:23:15 · 98 阅读 · 0 评论 -
1132 Cut Integer
题目来源:PAT (Advanced Level) PracticeCutting an integer means to cut a K digits lone integer Z into two integers of (K/2) digits long integers A and B. For example, after cutting Z = 167334, we have A = 167 and B = 334. It is interesting to see that Z can b原创 2021-07-31 09:20:33 · 100 阅读 · 0 评论 -
1001 A+B Format
题目来源:PAT (Advanced Level) PracticeCalculate 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).Input Specification:Each input file contains one te原创 2021-07-30 15:53:50 · 71 阅读 · 0 评论 -
1030 Travel Plan
题目来源:PAT (Advanced Level) PracticeA 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 start原创 2021-07-30 14:37:08 · 60 阅读 · 0 评论 -
1018 Public Bike Management
题目来源:PAT (Advanced Level) PracticeThere 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原创 2021-07-30 12:56:05 · 165 阅读 · 0 评论 -
1092 To Buy or Not to Buy
题目来源:PAT (Advanced Level) PracticeEva 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 who原创 2021-07-29 09:20:04 · 67 阅读 · 0 评论 -
1046 Shortest Distance
题目来源:PAT (Advanced Level) PracticeThe 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. F原创 2021-07-28 16:33:26 · 66 阅读 · 0 评论 -
1009 Product of Polynomials
题目来源:PAT (Advanced Level) PracticeThis 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 information of a polynomial原创 2021-07-28 15:42:42 · 71 阅读 · 0 评论 -
1094 The Largest Generation
A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population.Input Specification:Each input file contains one test case.原创 2021-07-28 12:59:16 · 35 阅读 · 0 评论 -
1105 Spiral Matrix (25 分)
题目来源:PAT (Advanced Level) PracticeThis time your job is to fill a sequence of N positive integers into a spiral matrix in non-increasing order. A spiral matrix is filled in from the first element at the upper-left corner, then move in a clockwise spiral.原创 2021-07-28 12:16:25 · 295 阅读 · 0 评论 -
1057 Stack
题目来源:PAT (Advanced Level) PracticeStack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Pop (deleting the top原创 2021-07-28 10:02:42 · 117 阅读 · 0 评论 -
1007 Maximum Subsequence Sum
题目来源:PAT (Advanced Level) PracticeGiven 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 subsequence which has the lar原创 2021-07-25 17:59:02 · 103 阅读 · 0 评论 -
1072 Gas Station
题目来源:PAT (Advanced Level) PracticeA gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all the houses are in its servi原创 2021-07-25 14:27:33 · 122 阅读 · 0 评论 -
1003 Emergency
题目来源:PAT (Advanced Level) PracticeAs 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 length of each road b原创 2021-07-25 11:44:08 · 66 阅读 · 0 评论 -
1076 Forwards on Weibo
题目来源:PAT (Advanced Level) PracticeWeibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on原创 2021-07-24 10:25:46 · 65 阅读 · 0 评论 -
1021 Deepest Root
题目来源:PAT (Advanced Level) PracticeA 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 deepes原创 2021-07-23 17:31:00 · 112 阅读 · 0 评论 -
1099 Build A Binary Search Tree
题目来源:PAT (Advanced Level) PracticeA 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 cont原创 2021-07-23 15:29:23 · 108 阅读 · 0 评论 -
1013 Battle Over Cities
题目来源:PAT (Advanced Level) PracticeIt 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 need to repair any othe原创 2021-07-22 23:47:22 · 71 阅读 · 0 评论 -
1146 Topological Order
题目来源:PAT (Advanced Level) PracticeThis 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原创 2021-07-21 10:15:27 · 132 阅读 · 0 评论 -
1069 The Black Hole of Numbers
题目来源:PAT (Advanced Level) PracticeFor 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原创 2021-07-20 23:52:04 · 86 阅读 · 0 评论 -
1022 Digital Library (30 分)
题目来源:PAT (Advanced Level) PracticeA 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原创 2021-07-20 16:52:07 · 49 阅读 · 0 评论 -
1071 Speech Patterns
题目来源:PAT (Advanced Level) PracticePeople often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzing such patterns can help to narrow down a speaker's identity, which i原创 2021-07-20 00:06:06 · 88 阅读 · 0 评论 -
1054 The Dominant Color
题目来源:PAT (Advanced Level) PracticeBehind 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 str原创 2021-07-19 16:35:54 · 62 阅读 · 0 评论