
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 · 295 阅读 · 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 · 126 阅读 · 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 · 120 阅读 · 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 · 245 阅读 · 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 · 261 阅读 · 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 · 247 阅读 · 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 · 126 阅读 · 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 · 273 阅读 · 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 · 202 阅读 · 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 · 224 阅读 · 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 · 9401 阅读 · 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 · 200 阅读 · 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 · 325 阅读 · 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 · 378 阅读 · 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 · 264 阅读 · 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 · 170 阅读 · 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 · 538 阅读 · 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 · 162 阅读 · 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 · 149 阅读 · 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 · 155 阅读 · 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 · 531 阅读 · 0 评论 -
1026
加油加油加油转载 2018-03-30 17:31:40 · 172 阅读 · 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 · 202 阅读 · 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 · 161 阅读 · 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 · 276 阅读 · 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 · 130 阅读 · 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 · 248 阅读 · 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 · 276 阅读 · 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 · 136 阅读 · 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 · 155 阅读 · 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 · 145 阅读 · 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 · 152 阅读 · 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 · 338 阅读 · 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 · 123 阅读 · 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 · 203 阅读 · 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 · 172 阅读 · 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 · 195 阅读 · 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 · 219 阅读 · 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 · 205 阅读 · 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 · 168 阅读 · 0 评论