PAT甲级
文章平均质量分 74
世界第一可爱ɞ
这个作者很懒,什么都没留下…
展开
-
PAT甲级1098 Insertion or Heap Sort (25 分)
1098 Insertion or Heap Sort (25 分)According to Wikipedia:Insertion sortiterates, 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 locatio...原创 2022-01-20 11:56:35 · 634 阅读 · 0 评论 -
PAT甲级1097 Deduplication on a Linked List (25 分)
1097 Deduplication on a Linked List (25 分)Given a singly linked listLwith integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each valueK, only the first node of which the value or absolute valu...原创 2022-01-19 10:46:08 · 180 阅读 · 0 评论 -
PAT甲级1096 Consecutive Factors (20 分)
1096 Consecutive Factors (20 分)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原创 2022-01-17 11:50:11 · 174 阅读 · 0 评论 -
PAT甲级1094 The Largest Generation (25 分)
1094 The Largest Generation (25 分)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原创 2022-01-13 11:39:08 · 71 阅读 · 0 评论 -
PAT甲级1093 Count PAT‘s (25 分)
1093 Count PAT's (25 分)The stringAPPAPTcontains twoPAT's as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4th, and the 6th characters.Now given any string, you are suppo...原创 2022-01-12 10:43:11 · 88 阅读 · 0 评论 -
PAT甲级1092 To Buy or Not to Buy (20 分)
1092 To Buy or Not to Buy (20 分)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原创 2022-01-11 10:44:56 · 133 阅读 · 0 评论 -
PAT甲级1090 Highest Price in Supply Chain (25 分)
1090 Highest Price in Supply Chain (25 分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the chain buys原创 2022-01-08 15:11:16 · 291 阅读 · 0 评论 -
PAT甲级1089 Insert or Merge (25 分)
1089 Insert or Merge (25 分)According to Wikipedia:Insertion sortiterates, 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 belo.原创 2022-01-07 11:41:58 · 328 阅读 · 0 评论 -
PAT甲级1088 Rational Arithmetic (20 分)
1088 Rational Arithmetic (20 分)For 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 one原创 2022-01-06 11:55:10 · 193 阅读 · 0 评论 -
PAT甲级1087 All Roads Lead to Rome (30 分)
1087 All Roads Lead to Rome (30 分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness.Input Specification:Each input file contains原创 2022-01-05 16:13:13 · 398 阅读 · 0 评论 -
PAT甲级1085 Perfect Sequence (25 分)
1085 Perfect Sequence (25 分)Given a sequence of positive integers and another positive integerp. The sequence is said to be aperfect sequenceifM≤m×pwhereMandmare the maximum and minimum numbers in the sequence, respectively.Now given a sequenc...原创 2022-01-03 14:46:41 · 514 阅读 · 0 评论 -
PAT甲级1084 Broken Keyboard (20 分)
1084 Broken Keyboard (20 分)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原创 2022-01-02 15:46:30 · 148 阅读 · 0 评论 -
PAT甲级1083 List Grades (25 分)
1083 List Grades (25 分)Given a list ofNstudent records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades are in a given interval.Input..原创 2021-09-17 17:36:44 · 276 阅读 · 0 评论 -
PAT甲级1081 Rational Sum (20 分)
1081 Rational Sum (20 分)GivenNrational numbers in the formnumerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive integerN(≤100), followed in the...原创 2021-09-15 18:15:38 · 80 阅读 · 0 评论 -
PAT甲级1080 Graduate Admission (30 分)
1080 Graduate Admission (30 分)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 applic原创 2021-09-14 17:49:09 · 54 阅读 · 0 评论 -
PAT甲级1079 Total Sales of Supply Chain (25 分)
1079 Total Sales of Supply Chain (25 分)A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the chain buys pr原创 2021-09-13 18:56:22 · 67 阅读 · 0 评论 -
PAT甲级1078 Hashing (25 分)
1078 Hashing (25 分)The 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 beH(key)=key%TSizewhereTSizeis the maximum size o...原创 2021-09-09 18:36:30 · 89 阅读 · 0 评论 -
PAT甲级1077 Kuchiguse (20 分)
1077 Kuchiguse (20 分)The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker's personality. Such a preference is called "Kuchiguse" and is often exaggera原创 2021-09-08 18:14:11 · 68 阅读 · 0 评论 -
PAT甲级1076 Forwards on Weibo (30 分)
1076 Forwards on Weibo (30 分)Weibo 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 Weib原创 2021-09-07 09:35:56 · 59 阅读 · 0 评论 -
PAT甲级1075 PAT Judge (25 分)
1075 PAT Judge (25 分)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.Input Specification:Each input file contains one test case. For each ca原创 2021-09-06 17:52:05 · 78 阅读 · 0 评论 -
PAT甲级1074 Reversing Linked List (25 分)
1074 Reversing Linked List (25 分)Given a constantKand a singly linked listL, you are supposed to reverse the links of everyKelements onL. For example, givenLbeing 1→2→3→4→5→6, ifK=3, then you must output 3→2→1→6→5→4; ifK=4, you must output 4→3→...原创 2021-09-05 19:41:11 · 71 阅读 · 0 评论 -
PAT甲级1073 Scientific Notation (20 分)
1073 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 integer portion has exactly原创 2021-09-04 13:15:33 · 66 阅读 · 0 评论 -
PAT甲级1072 Gas Station (30 分)
1072 Gas Station (30 分)A 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 service range.原创 2021-09-03 12:35:15 · 84 阅读 · 0 评论 -
PAT甲级1071 Speech Patterns (25 分)
1071 Speech Patterns (25 分)People 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 is usefu原创 2021-08-31 20:34:36 · 102 阅读 · 0 评论 -
PAT甲级 1070 Mooncake (25 分)
1070 Mooncake (25 分)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 th原创 2021-08-31 07:45:53 · 80 阅读 · 0 评论 -
PAT甲级 1069 The Black Hole of Numbers (20 分)
1069 The Black Hole of Numbers (20 分)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 numb原创 2021-08-29 16:15:30 · 47 阅读 · 0 评论 -
PAT甲级1067 Sort with Swap(0, i) (25 分)
1067 Sort with Swap(0, i) (25 分)Given any permutation of the numbers {0, 1, 2,...,N−1}, it is easy to sort them in increasing order. But what ifSwap(0, *)is the ONLY operation that is allowed to use? For example, to sort {4, 0, 2, 1, 3} we may apply t...原创 2021-08-27 07:54:01 · 67 阅读 · 0 评论 -
PAT甲级1068 Find More Coins (30 分)
1068 Find More Coins (30 分)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 requir原创 2021-08-27 07:52:13 · 193 阅读 · 0 评论 -
PAT甲级 1066 Root of AVL Tree (25 分)
1066 Root of AVL Tree (25 分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to restore this prop原创 2021-08-25 09:19:34 · 62 阅读 · 0 评论 -
PAT甲级1065 A+B and C (64bit) (20 分)
1065 A+B and C (64bit) (20 分)Given three integersA,BandCin (−263,263), you are supposed to tell whetherA+B>C.Input Specification:The first line of the input gives the positive number of test cases,T(≤10). ThenTtest cases follow, each con...原创 2021-08-24 07:54:07 · 77 阅读 · 0 评论 -
PAT甲级1064 Complete Binary Search Tree (30 分)
1064 Complete Binary Search Tree (30 分)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原创 2021-08-23 07:44:20 · 80 阅读 · 0 评论 -
PAT甲级1063 Set Similarity (25 分)
1063 Set Similarity (25 分)Given two sets of integers, the similarity of the sets is defined to beNc/Nt×100%, whereNcis the number of distinct common numbers shared by the two sets, andNtis the total number of distinct numbers in the two sets. Yo...原创 2021-08-21 09:46:57 · 71 阅读 · 0 评论 -
PAT甲级1062 Talent and Virtue (25 分)
1062 Talent and Virtue (25 分)About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theory, a man being outstanding in both talent and virtue must be a "sage(圣人)";原创 2021-08-19 08:17:22 · 66 阅读 · 0 评论 -
PAT甲级1061 Dating (20 分)
1061 Dating (20 分)Sherlock Holmes received a note with some strange strings:Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that those strange strings are actually referring to the cod...原创 2021-08-18 08:53:40 · 70 阅读 · 0 评论