![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
PAT
比锅
这个作者很懒,什么都没留下…
展开
-
1043
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 the node's key.The right subtre转载 2018-04-13 14:02:19 · 267 阅读 · 0 评论 -
1030
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 decide the shortest path be原创 2018-04-02 16:24:41 · 114 阅读 · 0 评论 -
1029
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, 15, 16, 17} is 15. The原创 2018-04-02 15:01:13 · 105 阅读 · 0 评论 -
1038
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 numbers such like 32-321-3214-0229-87原创 2018-04-09 15:38:52 · 222 阅读 · 0 评论 -
1037
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 value of that product ba原创 2018-04-09 14:55:07 · 233 阅读 · 0 评论 -
1022
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 an unique 7-digit number a...转载 2018-03-26 15:56:25 · 229 阅读 · 0 评论 -
1036
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 input file contains one test c原创 2018-04-08 15:51:31 · 107 阅读 · 0 评论 -
1027
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 for Red, the middle 2 digi原创 2018-03-31 14:58:53 · 241 阅读 · 0 评论 -
1028
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 contains two integers N (<=10000原创 2018-03-31 15:56:10 · 178 阅读 · 0 评论 -
1023
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 to be another 9-digit number cons原创 2018-03-27 16:04:05 · 206 阅读 · 0 评论 -
1024
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 numbers are palindromic numbers.原创 2018-03-27 17:15:21 · 9323 阅读 · 0 评论 -
1039
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 ...原创 2018-04-10 13:00:38 · 175 阅读 · 0 评论 -
1034
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 relation is defined to be th原创 2018-04-06 15:09:36 · 298 阅读 · 0 评论 -
1042
piccolo 同一题目5秒内只能提交1次 1042. Shuffling Machine (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, YueShuffling is a procedure used to randomize a deck of playing cards. Bec原创 2018-04-12 12:55:13 · 341 阅读 · 0 评论 -
1041
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原创 2018-04-12 11:52:13 · 241 阅读 · 0 评论 -
1033
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 way from time to time. Different gas转载 2018-04-05 15:55:35 · 143 阅读 · 0 评论 -
1025
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 wi原创 2018-03-29 16:20:25 · 514 阅读 · 0 评论 -
1040(!)
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 is “s PAT&TAP s”, hence you must原创 2018-04-11 12:28:22 · 141 阅读 · 0 评论 -
1032
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,原创 2018-04-03 15:52:08 · 123 阅读 · 0 评论 -
1031
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 lowoThat is, the characters must be print原创 2018-04-03 14:49:37 · 135 阅读 · 0 评论 -
1035
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 i原创 2018-04-08 15:19:01 · 506 阅读 · 0 评论 -
1026
加油加油加油转载 2018-03-30 17:31:40 · 122 阅读 · 0 评论 -
1021
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 highest tree. Such a root i原创 2018-03-24 16:43:00 · 169 阅读 · 0 评论 -
1009
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 informa...原创 2018-03-12 17:11:28 · 133 阅读 · 0 评论 -
1008
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec...原创 2018-03-12 15:16:51 · 247 阅读 · 0 评论 -
1007
Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj } where 1 <= i <= j <= K. The Maximum Subsequence is the continuous subsequence w...原创 2018-03-11 20:22:04 · 111 阅读 · 0 评论 -
1006
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 records of signing in’s and out’s, you原创 2018-03-10 16:38:18 · 207 阅读 · 0 评论 -
1005
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 cas原创 2018-03-10 15:01:47 · 211 阅读 · 0 评论 -
1004
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 case starts with a line co...原创 2018-03-09 17:25:27 · 115 阅读 · 0 评论 -
1003
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 in each city and the l...原创 2018-03-08 16:49:28 · 127 阅读 · 0 评论 -
1002
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 contains the information of a polyn...原创 2018-03-05 21:14:45 · 124 阅读 · 0 评论 -
1010
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is “yes”, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive in...原创 2018-03-14 18:29:52 · 126 阅读 · 0 评论 -
1011
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 Cup trophy in South Africa. Si...原创 2018-03-14 19:55:52 · 302 阅读 · 0 评论 -
1012
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 Algebra), and E - Eng...原创 2018-03-15 16:38:53 · 103 阅读 · 0 评论 -
1020
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 traversal sequence of the corr转载 2018-03-23 21:03:53 · 169 阅读 · 0 评论 -
1019
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 numbers are palindromic numbers.原创 2018-03-23 19:19:23 · 159 阅读 · 0 评论 -
1018
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 return it to any other stations in the c原创 2018-03-22 21:13:06 · 176 阅读 · 0 评论 -
1017
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 in line behind the yellow lin原创 2018-03-21 21:02:43 · 191 阅读 · 0 评论 -
1016
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 the call is made. When a原创 2018-03-20 21:05:41 · 179 阅读 · 0 评论 -
1015
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 because its reverse 37 is also a pr...原创 2018-03-18 15:57:18 · 142 阅读 · 0 评论