- 博客(62)
- 收藏
- 关注
原创 PAT 甲级 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 proportional area is called the d
2017-09-30 21:55:15 292
原创 PAT 甲级 1053. Path of Equal Weight (30)
Given a non-empty tree with root R, and with weight Wi assigned to each tree node Ti. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path from R
2017-09-30 21:51:50 180
原创 PAT 甲级 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 to the next structure. Now give
2017-09-30 13:10:50 142
原创 PAT 甲级 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 possible pop sequence of t
2017-09-30 12:51:44 207
原创 PAT 甲级 1050. String Subtraction (20)
Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However,
2017-09-30 01:20:48 166
原创 PAT 甲级 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 being 12, there are five 1's i
2017-09-30 01:19:55 159
原创 PAT 甲级 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 coins as payments. However,
2017-09-30 00:50:07 170
原创 PAT 甲级 1047. Student List for Course (25)
Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses. Input S
2017-09-30 00:34:33 174
原创 PAT 甲级 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 Specification: Each input file c
2017-09-29 17:19:55 162
原创 PAT 甲级 1045. Favorite 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 pieces and sewing the remaining parts
2017-09-29 16:40:44 183
原创 PAT 甲级 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 chain can be cut at any position
2017-09-29 15:22:35 153
原创 PAT 甲级 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 less than the node's key. The righ
2017-09-29 14:38:36 162
原创 PAT 甲级 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 employees collaborate with gambler
2017-09-29 14:12:03 168
原创 PAT 甲级 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, 104]. The first one who bets on
2017-09-28 10:40:51 160
原创 PAT 甲级 1040. Longest Symmetric String (25)
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
2017-09-28 10:37:15 156
原创 PAT 甲级 1039. Course 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 course list for each student who comes
2017-09-26 15:38:59 155
原创 PAT 甲级 1038. Recover 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 recover many numbers such like 32-321-3214-0229-8
2017-09-25 17:24:19 169
原创 PAT 甲级 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 value of that product b
2017-09-25 16:42:33 133
原创 PAT 甲级 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 input file contains o
2017-09-25 15:27:24 172
原创 PAT 甲级 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 distinguish 1 (one) from l (L
2017-09-24 18:22:13 187
原创 PAT 甲级 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 relation is defined to be t
2017-09-24 18:21:13 175
原创 PAT 甲级 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 way from time to time. Different ga
2017-09-24 15:47:44 208
原创 PAT 甲级 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 suffix. For example,
2017-09-24 15:05:41 210
原创 PAT 甲级 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 That is, the characters must be pr
2017-09-24 14:51:10 164
原创 PAT 甲级 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 decide the shortest path b
2017-09-24 14:50:23 136
原创 PAT 甲级 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, 15, 16, 17} is 15. The
2017-09-23 17:32:36 152
原创 PAT 甲级 1028. List Sorting (25)
Excel can sort records according to any column. Now you are supposed to imitate this function. Input Each input file contains one test case. For each case, the first line contains two integers N
2017-09-23 16:49:44 180
原创 PAT 甲级 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 for Red, the middle 2 dig
2017-09-23 15:38:22 146
原创 PAT 甲级 1026. Table Tennis (30)
A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open when they arrive, they will be assigned to the ava
2017-09-23 15:34:21 462
原创 PAT 甲级 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 places, and the ranklists w
2017-09-23 00:13:05 142
原创 PAT 甲级 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 numbers are palindromic numbers
2017-09-22 23:37:06 174
原创 PAT 甲级 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 to be another 9-digit number con
2017-09-22 18:57:18 149
原创 PAT 甲级 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 an unique 7-digit number a
2017-09-22 18:18:38 159
原创 PAT 甲级 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 highest tree. Such a root ...
2017-09-22 17:43:12 168
原创 PAT 甲级 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 traversal sequence of the cor
2017-09-22 17:05:36 156
原创 PAT 甲级 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 digit numbers are palindromic numbers
2017-09-21 13:34:03 131
原创 PAT 甲级 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 return it to any other stations in the
2017-09-20 21:37:41 179
原创 PAT 甲级 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 in line behind the yellow li
2017-09-20 20:23:18 494
原创 PAT 甲级 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 the call is made. Wh
2017-09-20 20:00:24 139
原创 PAT 甲级 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 because its reverse 37 is also a pr
2017-09-20 18:07:38 147
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人