
pat
文章平均质量分 63
.
鸡冠花12138
这个作者很懒,什么都没留下…
展开
-
1063 Set Similarity
1063Set 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, andN...原创 2019-05-06 18:24:58 · 234 阅读 · 0 评论 -
1049 Counting Ones
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, givenNbei...原创 2019-04-04 14:12:14 · 408 阅读 · 0 评论 -
1048 Find Coins
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-04-04 09:59:34 · 138 阅读 · 0 评论 -
1037 Magic Coupon
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-03-22 20:47:48 · 238 阅读 · 0 评论 -
1042 Shuffling Machine
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-03-26 13:04:07 · 160 阅读 · 0 评论 -
1041 Be Unique
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-03-26 11:07:30 · 119 阅读 · 0 评论 -
1036 Boys vs Girls
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-03-22 16:00:50 · 217 阅读 · 0 评论 -
1035 Password
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-03-22 15:03:08 · 250 阅读 · 0 评论 -
1040 Longest Symmetric String
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-03-25 20:12:59 · 170 阅读 · 0 评论 -
1039 Course List for Student
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-03-25 19:23:27 · 112 阅读 · 0 评论 -
1025 PAT Ranking
1025PAT 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 pl...原创 2019-03-13 18:47:55 · 154 阅读 · 0 评论 -
1032 Sharing
1032Sharing(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...原创 2019-03-18 19:14:13 · 138 阅读 · 0 评论 -
1031 Hello World for U
1031Hello World for U(20分)Given any string ofN(≥5) characters, you are asked to form the characters into the shape ofU. For example,helloworldcan be printed as:h de ll rlowoThat ...原创 2019-03-18 18:37:36 · 103 阅读 · 0 评论 -
1024 Palindromic Number
1024Palindromic Number(25分)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 single digit...原创 2019-03-13 16:38:57 · 204 阅读 · 0 评论 -
1023 Have Fun with Numbers
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-03-13 15:37:09 · 354 阅读 · 0 评论 -
1038 Recover the Smallest Number
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-03-25 13:21:22 · 306 阅读 · 0 评论 -
1043 Is It a Binary Search Tree
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-03-27 09:39:48 · 240 阅读 · 0 评论 -
1055 The World's Richest
1055The 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, ...原创 2019-04-10 11:03:45 · 210 阅读 · 0 评论 -
1044 Shopping in Mars
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$). When making the payment, the cha...原创 2019-03-27 20:29:24 · 127 阅读 · 0 评论 -
1062 Talent and Virtue
1062Talent 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 outs...原创 2019-04-30 13:39:22 · 282 阅读 · 0 评论 -
1061 Dating
1061Dating(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 t...原创 2019-04-30 12:32:43 · 216 阅读 · 0 评论 -
1060 Are They Equal
If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as0.123×105with simple chopping. Now given the number of signif...原创 2019-04-30 10:18:42 · 172 阅读 · 0 评论 -
1059 Prime Factors
1059Prime Factors(25分)Given any positive integerN, you are supposed to find all of its prime factors, and write them in the formatN=p1k1×p2k2×⋯×pmkm.Input Specifi...原创 2019-04-14 12:49:23 · 230 阅读 · 0 评论 -
1058 A+B in Hogwarts
1058A+B in Hogwarts(20分)If you are a fan of Harry Potter, you would know the world of magic has its own currency system -- as Hagrid explained it to Harry, "Seventeen silver Sickles to a Galleon ...原创 2019-04-14 12:20:44 · 175 阅读 · 0 评论 -
1054 The Dominant Color
1054The 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 p...原创 2019-04-10 09:04:50 · 134 阅读 · 0 评论 -
1057 Stack
1057Stack(30分)Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the t...原创 2019-04-12 20:16:35 · 253 阅读 · 0 评论 -
1053 Path of Equal Weight
1053Path of Equal Weight(30分)Given a non-empty tree with rootR, and with weightWiassigned to each tree nodeTi. Theweight of a path fromRtoLis defined to be the sum of the weights o...原创 2019-04-09 15:20:58 · 126 阅读 · 0 评论 -
1047 Student List for Course
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-04-03 10:13:26 · 156 阅读 · 0 评论 -
1052 Linked List Sorting
1052Linked 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 integerkeyand aNextpointe...原创 2019-04-09 09:25:16 · 116 阅读 · 0 评论 -
1046 Shortest Distance
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-04-03 09:18:35 · 153 阅读 · 0 评论 -
1051 Pop Sequence
1051Pop Sequence(25分)Given a stack which can keepMnumbers at most. PushNnumbers in the order of 1, 2, 3, ...,Nand pop randomly. You are supposed to tell if a given sequence of numbers is a ...原创 2019-04-08 21:00:05 · 144 阅读 · 0 评论 -
1050 String Subtraction
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-04-08 20:22:50 · 160 阅读 · 0 评论 -
1056 Mice and Rice
1056 Mice and Rice (25 分)Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each m...原创 2019-04-11 23:07:59 · 125 阅读 · 0 评论 -
1045 Favorite Color Stripe
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-03-28 09:47:38 · 261 阅读 · 0 评论 -
1034 Head of a Gang
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-03-21 18:52:13 · 231 阅读 · 0 评论 -
1022 Digital Library
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-03-13 11:47:57 · 241 阅读 · 0 评论 -
1030 Travel Plan
1030Travel 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 d...原创 2019-03-18 12:14:45 · 207 阅读 · 0 评论 -
1015 Reversible Primes
1015Reversible Primes(20 分)Areversible primein 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 beca...原创 2019-03-05 11:53:51 · 231 阅读 · 0 评论 -
1003 Emergency
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...原创 2019-02-26 10:05:14 · 338 阅读 · 0 评论 -
1002 A+B for Polynomials
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, a...原创 2019-02-26 09:58:44 · 434 阅读 · 0 评论