
PAT甲级
文章平均质量分 95
rf4csdm
;p
展开
-
PAT 甲级1004 Counting Leaves (30 分)
1004Counting Leaves(30分)A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.Input Specification:Each input file contains on...原创 2019-03-13 21:16:45 · 430 阅读 · 0 评论 -
PAT 甲级1001 A+B Format (20 分)
1001A+B Format(20 分)Calculatea+band 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 Spe...原创 2019-03-09 23:40:33 · 163 阅读 · 0 评论 -
PAT 甲级1005 Spell It Right (20 分)
1005Spell It Right(20分)Given a non-negative integerN, your task is to compute the sum of all the digits ofN, and output every digit of the sum in English.Input Specification:Each input file...原创 2019-03-14 20:18:54 · 292 阅读 · 0 评论 -
PAT 甲级1006 Sign In and Sign Out (25 分)
1006Sign In and Sign Out(25分)At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the reco...原创 2019-03-15 20:09:39 · 234 阅读 · 0 评论 -
PAT 甲级1007 Maximum Subsequence Sum (25 分)
1007Maximum Subsequence Sum(25分)Given a sequence ofKintegers {N1,N2, ...,NK}. A continuous subsequence is defined to be {Ni,Ni+1, ...,Nj} where1≤i≤j≤K. The Maximum Su...原创 2019-03-15 20:38:04 · 227 阅读 · 0 评论 -
PAT 甲级1008 Elevator (20 分)
1008Elevator(20分)The highest building in our city has only one elevator. A request list is made up withNpositive numbers. The numbers denote at which floors the elevator will stop, in specified...原创 2019-03-15 20:54:13 · 244 阅读 · 0 评论 -
PAT 甲级1009 Product of Polynomials (25 分)
1009Product of Polynomials(25分)This time, you are supposed to findA×BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines...原创 2019-03-16 21:18:10 · 255 阅读 · 0 评论 -
PAT 甲级1010 Radix (25 分)
1010Radix(25分)Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number.Now for any pa...原创 2019-03-17 21:28:23 · 220 阅读 · 0 评论 -
PAT 甲级1002 A+B for Polynomials (25 分)
1002 A+B for 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 ...原创 2019-03-12 23:37:27 · 271 阅读 · 0 评论 -
PAT 甲级1012 The Best Rank (25 分)
1012The 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 L...原创 2019-03-24 21:47:52 · 175 阅读 · 0 评论 -
PAT 甲级1011 World Cup Betting (20 分)
1011World Cup Betting(20分)With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World...原创 2019-03-21 21:56:17 · 165 阅读 · 0 评论 -
PAT 甲级1003 Emergency (25 分)
1003Emergency(25分)As 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...原创 2019-03-13 20:45:25 · 456 阅读 · 0 评论 -
PAT甲级1017 Queueing at Bank (25 分)
1017Queueing at Bank(25分)Suppose a bank hasKwindows 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 wai...原创 2019-07-01 18:45:08 · 150 阅读 · 0 评论 -
pat甲级1013 Battle Over Cities (25 分)
1013Battle Over Cities(25分)It 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...原创 2019-06-23 19:51:45 · 206 阅读 · 0 评论 -
PAT甲级1018 Public Bike Management (30 分)
1018Public 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 ret...原创 2019-07-02 18:34:30 · 141 阅读 · 0 评论 -
PAT甲级1019 General Palindromic Number (20 分)
1019General Palindromic Number(20分)A number that will be the same when it is written forwards or backwards is known as aPalindromic Number. For example, 1234321 is a palindromic number. All sing...原创 2019-07-02 19:43:58 · 158 阅读 · 0 评论 -
PAT甲级1014 Waiting in Line (30 分)
1014Waiting in Line(30分)Suppose a bank hasNwindows 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...原创 2019-06-24 21:04:29 · 163 阅读 · 0 评论 -
PAT 甲级A1020 Tree Traversals (25 分)
1020Tree 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 ...原创 2019-01-28 23:17:51 · 116 阅读 · 0 评论 -
PAT甲级1022 Digital Library (30 分)
1022Digital 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 assign...原创 2019-07-13 18:31:36 · 163 阅读 · 0 评论 -
PAT甲级1021 Deepest Root (25 分)
1021Deepest 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 ...原创 2019-07-04 18:41:10 · 141 阅读 · 0 评论 -
PAT甲级1016 Phone Bills (25 分)
1016Phone 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 wh...原创 2019-06-29 20:48:52 · 162 阅读 · 0 评论 -
PAT 甲级1023 Have Fun with Numbers (20 分)
1023Have 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 happe...原创 2019-07-15 18:41:53 · 143 阅读 · 0 评论 -
PAT甲级1034 Head of a Gang (30 分)
1034Head 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 betweenAandB, we say thatAandBis related. The weight of a...原创 2019-08-02 15:38:25 · 150 阅读 · 0 评论 -
PAT甲级1035 Password (20 分)
1035Password(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 distingu...原创 2019-08-02 16:31:06 · 140 阅读 · 0 评论 -
PAT甲级1036 Boys vs Girls (25 分)
1036Boys 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:Eac...原创 2019-08-02 17:45:37 · 173 阅读 · 0 评论 -
PAT甲级1037 Magic Coupon (25 分)
1037Magic Coupon(25分)The magic shop in Mars is offering some magic coupons. Each coupon has an integerNprinted on it, meaning that when you use this coupon with a product, you may getNtimes t...原创 2019-08-02 18:04:52 · 114 阅读 · 0 评论 -
PAT甲级1038 Recover the Smallest Number (30 分)
1038Recover 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 recove...原创 2019-08-02 18:26:23 · 130 阅读 · 0 评论 -
PAT甲级1039 Course List for Student (25 分)
1039Course 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 co...原创 2019-08-02 19:04:22 · 172 阅读 · 0 评论 -
PAT甲级1040 Longest Symmetric String (25 分)
1040Longest Symmetric String(25分)Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, givenIs PAT&TAP symmetric?, the longest symmetric sub...原创 2019-08-02 19:31:04 · 183 阅读 · 0 评论 -
PAT甲级1041 Be Unique (20 分)
1041Be 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]. T...原创 2019-08-03 18:53:28 · 190 阅读 · 0 评论 -
PAT甲级1042 Shuffling Machine (20 分)
1042Shuffling 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 emp...原创 2019-08-03 19:23:36 · 190 阅读 · 0 评论 -
PAT甲级1043 Is It a Binary Search Tree (25 分)
1043Is 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...原创 2019-08-03 20:59:24 · 141 阅读 · 0 评论 -
PAT甲级1044 Shopping in Mars (25 分)
1044Shopping 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 cha...原创 2019-08-03 21:56:23 · 133 阅读 · 0 评论 -
PAT甲级1045 Favorite Color Stripe (30 分)【动态规划LIS】
1045Favorite 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 pi...原创 2019-08-03 22:31:24 · 173 阅读 · 0 评论 -
PAT甲级1045 Favorite Color Stripe (30 分)【动态规划LCS】
1045Favorite 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 pi...原创 2019-08-03 22:35:02 · 137 阅读 · 0 评论 -
PAT甲级1046 Shortest Distance (20 分)
1046Shortest Distance(20分)The task is really simple: givenNexits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specif...原创 2019-08-03 23:11:36 · 156 阅读 · 0 评论 -
PAT甲级1047 Student List for Course (25 分)
1047Student 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 na...原创 2019-08-03 23:25:21 · 203 阅读 · 0 评论 -
PAT甲级1048 Find Coins (25 分)
1048Find 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 coi...原创 2019-08-03 23:39:11 · 186 阅读 · 0 评论 -
PAT甲级1049 Counting Ones (30 分)
1049Counting Ones(30分)The task is simple: given any positive integerN, you are supposed to count the total number of 1's in the decimal form of the integers from 1 toN. For example, givenNbein...原创 2019-08-04 23:30:54 · 142 阅读 · 0 评论 -
PAT甲级1050 String Subtraction (20 分)
1050String Subtraction(20分)Given two stringsS1andS2,S=S1−S2is defined to be the remaining string after taking all the characters inS2fromS1. Your task is simply to calcu...原创 2019-08-04 23:42:31 · 108 阅读 · 0 评论