
PAT甲级
文章平均质量分 71
ChenyutingZJU
这个作者很懒,什么都没留下…
展开
-
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 · 148 阅读 · 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 · 255 阅读 · 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 · 129 阅读 · 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 · 492 阅读 · 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 · 103 阅读 · 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 · 199 阅读 · 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 · 130 阅读 · 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 · 140 阅读 · 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 · 324 阅读 · 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 · 363 阅读 · 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 · 524 阅读 · 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 · 111 阅读 · 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 · 496 阅读 · 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 · 284 阅读 · 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 · 136 阅读 · 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 · 498 阅读 · 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 · 411 阅读 · 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 · 402 阅读 · 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 · 147 阅读 · 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 · 177 阅读 · 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 · 188 阅读 · 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, b...原创 2018-08-31 11:48:06 · 1050 阅读 · 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 · 218 阅读 · 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 · 293 阅读 · 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 · 121 阅读 · 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 · 108 阅读 · 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 · 110 阅读 · 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 · 214 阅读 · 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 · 234 阅读 · 0 评论 -
1014 Waiting in Line (30)
1014 Waiting in Line (30) Suppose 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 w...转载 2018-08-15 10:50:17 · 110 阅读 · 0 评论 -
1013 Battle Over Cities (25)
1013 Battle 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 m...原创 2018-08-15 10:11:52 · 184 阅读 · 0 评论 -
1006 Sign In and Sign Out (25)
1006 Sign 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 record...原创 2018-08-12 12:38:56 · 131 阅读 · 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 c...原创 2018-08-12 11:38:40 · 230 阅读 · 0 评论 -
1004 Counting Leaves (30)
1004 Counting Leaves (30) A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each...原创 2018-08-12 11:21:54 · 230 阅读 · 0 评论 -
1003 Emergency (25)
1003 Emergency (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 i...原创 2018-08-11 13:30:18 · 277 阅读 · 0 评论 -
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.InputEach input file contains one test case. Each case occupies 2 lines, and each line cont...原创 2018-08-11 12:00:43 · 122 阅读 · 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).InputEac...原创 2018-08-11 11:32:26 · 179 阅读 · 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 Lin...原创 2018-08-14 13:37:23 · 163 阅读 · 0 评论 -
1011 World Cup Betting (20)
1011 World 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 C...原创 2018-08-14 12:47:39 · 103 阅读 · 0 评论 -
1007 Maximum Subsequence Sum (25)
1007 Maximum Subsequence Sum (25) Given a sequence of K integers { N~1~, N~2~, …, N~K~ }. A continuous subsequence is defined to be { N~i~, N~i+1~, …, N~j~ } where 1 <= i <= j <= K. The Maxi...原创 2018-08-13 12:36:52 · 112 阅读 · 0 评论