
PAT 甲级
文章平均质量分 76
Tropine
这个作者很懒,什么都没留下…
展开
-
PAT甲级做题记录
这次我一定会完成!!!!题目链接1012 The Best Rank (25 分)1012 The Best Rank (25 分)1025 PAT Ranking (25 分)1025 PAT Ranking (25 分)1028 List Sorting (25 分)1028 List Sorting (25 分)1053 Path of Equal Weight (30 分)1053 Path of Equal Weight (30 分)1055原创 2021-09-27 10:56:26 · 192 阅读 · 0 评论 -
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 yo原创 2021-10-11 16:13:05 · 169 阅读 · 0 评论 -
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 d原创 2021-10-11 15:57:17 · 173 阅读 · 0 评论 -
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 5原创 2021-10-11 15:25:24 · 209 阅读 · 0 评论 -
1048 Find Coins (25 分)并未AC
1048 Find Coins (25 分)并未ACEva 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 requirem原创 2021-10-04 21:16:43 · 234 阅读 · 0 评论 -
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,原创 2021-10-04 20:58:05 · 138 阅读 · 0 评论 -
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 in原创 2021-10-04 20:41:04 · 113 阅读 · 0 评论 -
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 S原创 2021-10-04 20:06:47 · 158 阅读 · 0 评论 -
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 sho原创 2021-10-03 17:40:56 · 121 阅读 · 0 评论 -
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 each原创 2021-10-03 10:17:42 · 104 阅读 · 0 评论 -
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 inadequate原创 2021-10-02 23:24:44 · 109 阅读 · 0 评论 -
1009 Product of Polynomials (25 分)
1009 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 information of a polynomial:K原创 2021-10-02 22:56:38 · 127 阅读 · 0 评论 -
1152 Google Recruitment (20 分)
1152 Google Recruitment (20 分)In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is super-simple, a URL consisting of the first 10-digit prime found in consecutive原创 2021-10-02 16:04:40 · 271 阅读 · 0 评论 -
1140 Look-and-say Sequence (20 分)
1140 Look-and-say Sequence (20 分)Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...where D is in [0, 9] except 1. The (n+1)st number is a kind of description of the nth number. For example, the 2原创 2021-10-02 15:43:17 · 135 阅读 · 0 评论 -
1108 Finding Average (20 分)
1108 Finding Average (20 分)The 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,1000] and原创 2021-10-02 15:26:25 · 116 阅读 · 0 评论 -
1082 Read Number in Chinese (25 分)
1082 Read Number in Chinese (25 分)Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For example, -123456789 is read as Fu yi Yi er Qian san Bai si Shi wu Wan liu Qia原创 2021-09-30 14:42:10 · 125 阅读 · 0 评论 -
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 on原创 2021-09-30 14:10:32 · 118 阅读 · 0 评论 -
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 (原创 2021-09-29 20:53:32 · 116 阅读 · 0 评论 -
1005 Spell It Right (20 分)
1005 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. Each case occupies one line which原创 2021-09-29 20:31:13 · 104 阅读 · 0 评论 -
1001 A+B Format (20 分)
1001 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).Input Specification:Each input file contains one test case. Each ca原创 2021-09-29 20:22:05 · 127 阅读 · 0 评论 -
1115 Counting Nodes in a BST (30 分)
1115 Counting Nodes in a BST (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 or equal to the node’s key.The right subtree of原创 2021-09-29 20:19:48 · 144 阅读 · 1 评论 -
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 pr原创 2021-09-29 18:48:21 · 98 阅读 · 0 评论 -
1102 Invert a Binary Tree (25 分)
1102 Invert a Binary Tree (25 分)The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck off.Now it’s your turn to prove that YOU CAN invert原创 2021-09-28 20:36:08 · 121 阅读 · 0 评论 -
1086 Tree Traversals Again (25 分)
1086 Tree Traversals Again (25 分)An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stack operations are: push原创 2021-09-28 16:48:45 · 99 阅读 · 0 评论 -
1146 Shortest Distance (20 分)
1146 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 each原创 2021-09-28 15:37:06 · 104 阅读 · 0 评论 -
1125 Chain the Ropes (25 分)
1125 Chain the Ropes (25 分)Given some segments of rope, you are supposed to chain them into one rope. Each time you may only fold two segments into loops and chain them into one piece, as shown by the figure. The resulting chain will be treated as another原创 2021-09-27 16:40:21 · 124 阅读 · 0 评论 -
1113 Integer Set Partition (25 分)
1113 Integer Set Partition (25 分)Given a set of N (>1) positive integers, you are supposed to partition them into two disjoint sets A1 and A2 of n1 and n2 numbers, respectively. Let S1 and S2 denote the sums of all the numbers in A1 and A2, respectivel原创 2021-09-27 16:20:27 · 105 阅读 · 0 评论 -
1101 Quick Sort (25 分)
1101 Quick Sort (25 分)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 pivo原创 2021-09-27 11:28:18 · 130 阅读 · 0 评论 -
1053 Path of Equal Weight (30 分)
1053 Path of Equal Weight (30 分)Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. 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 node L.Now g原创 2021-09-27 10:37:39 · 117 阅读 · 0 评论 -
1083 List Grades (25 分)
1083 List Grades (25 分)Given a list of N student 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 S原创 2021-09-25 20:13:53 · 321 阅读 · 0 评论 -
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 of原创 2021-09-25 17:05:10 · 323 阅读 · 0 评论 -
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 N原创 2021-09-25 16:37:47 · 105 阅读 · 0 评论 -
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 after原创 2021-09-25 15:58:41 · 219 阅读 · 0 评论 -
1012 The Best Rank (25 分)
1012 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 Algrbra), and E - English. At the mean time, we enc原创 2021-09-25 15:13:06 · 312 阅读 · 0 评论