
PAT甲级
文章平均质量分 71
ChenyutingZJU
这个作者很懒,什么都没留下…
展开
-
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, b...原创 2018-08-31 11:48:06 · 1044 阅读 · 2 评论 -
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 pr...原创 2018-08-31 11:17:31 · 215 阅读 · 0 评论 -
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 ...转载 2018-08-31 11:01:14 · 292 阅读 · 0 评论 -
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...原创 2018-08-28 12:33:41 · 281 阅读 · 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 pos...转载 2018-08-28 11:50:21 · 493 阅读 · 0 评论 -
1050 String Subtraction(20 分)
1050 String Subtraction(20 分) Given two strings S 1 and S 2 , S=S 1 −S 2 is defined to be the remaining string after taking all the characters in S 2 from S 1 ....原创 2018-08-28 11:26:57 · 253 阅读 · 0 评论 -
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 bein...原创 2018-08-27 13:03:44 · 323 阅读 · 0 评论 -
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 coin...原创 2018-08-27 12:36:24 · 361 阅读 · 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 nam...原创 2018-08-27 11:38:08 · 519 阅读 · 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 Specifi...原创 2018-08-26 14:44:11 · 272 阅读 · 0 评论 -
1045 Favorite Color Stripe(30 分
1045 Favorite Color Stripe(30 分 Eva’s favorite colors are limited. However the original stripe could be very long, and Eva would like to have the remaining favorite stripe with the maximum length. So...原创 2018-08-26 14:11:25 · 470 阅读 · 0 评论 -
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).Whenmakingthepayment,thechaincanbec...原创 2018-08-26 13:27:26 · 306 阅读 · 0 评论 -
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 ...原创 2018-08-25 13:48:44 · 495 阅读 · 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 empl...原创 2018-08-25 13:12:57 · 410 阅读 · 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,10 4 ...原创 2018-08-25 12:24:58 · 399 阅读 · 0 评论 -
1040 Longest Symmetric String
1040 Longest Symmetric String 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...原创 2018-08-24 12:53:19 · 146 阅读 · 0 评论 -
1039 Course List for Student
1039 Course List for Student 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 li...原创 2018-08-24 12:08:30 · 175 阅读 · 0 评论 -
1038 Recover the Smallest Number
1038 Recover the Smallest Number 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 ...原创 2018-08-24 11:12:45 · 185 阅读 · 0 评论 -
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...原创 2018-08-23 12:28:02 · 125 阅读 · 0 评论 -
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 ...原创 2018-08-23 11:43:47 · 491 阅读 · 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 distinguis...原创 2018-08-23 11:12:39 · 100 阅读 · 0 评论 -
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 r...转载 2018-08-21 12:17:45 · 118 阅读 · 0 评论 -
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 w...转载 2018-08-21 11:24:33 · 106 阅读 · 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 s...原创 2018-08-21 10:19:39 · 135 阅读 · 0 评论 -
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 d e l l r lowo ...原创 2018-08-20 13:29:28 · 198 阅读 · 0 评论 -
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 dec...原创 2018-08-20 13:02:55 · 128 阅读 · 0 评论 -
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...转载 2018-08-20 11:44:01 · 137 阅读 · 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.InputEach input file contains one test case. For each case, the first line con...原创 2018-08-19 11:33:24 · 235 阅读 · 0 评论 -
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...原创 2018-08-19 11:14:37 · 72 阅读 · 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 plac...原创 2018-08-19 11:00:43 · 98 阅读 · 0 评论 -
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 n...原创 2018-08-18 13:16:54 · 155 阅读 · 0 评论 -
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...原创 2018-08-18 12:47:43 · 88 阅读 · 0 评论 -
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...原创 2018-08-18 11:42:58 · 147 阅读 · 0 评论 -
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 hi...原创 2018-08-17 12:11:00 · 109 阅读 · 0 评论 -
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 tr...原创 2018-08-17 11:24:21 · 108 阅读 · 0 评论 -
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...原创 2018-08-17 10:44:15 · 212 阅读 · 0 评论 -
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 retur...转载 2018-08-16 16:51:38 · 174 阅读 · 0 评论 -
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 ...转载 2018-08-16 12:34:14 · 172 阅读 · 0 评论 -
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...转载 2018-08-16 11:52:03 · 197 阅读 · 0 评论 -
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 becaus...原创 2018-08-15 11:14:13 · 229 阅读 · 0 评论