- 博客(23)
- 收藏
- 关注
原创 PAT (Advanced Level) Practice 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 ...
2019-12-31 14:10:49 354
原创 PAT (Advanced Level) Practice 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 right sub...
2019-12-31 13:40:54 116
原创 PAT (Advanced Level) Practice 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...
2019-12-30 15:17:52 116
原创 PAT (Advanced Level) Practice 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][1,10^4][1,104]. The first on...
2019-12-30 14:45:18 236
原创 PAT (Advanced Level) Practice 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 ...
2019-12-29 17:47:13 127 1
原创 PAT (Advanced Level) Practice 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 ...
2019-12-29 17:34:16 91
原创 PAT (Advanced Level) Practice 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...
2019-12-29 16:07:12 100
原创 PAT (Advanced Level) Practice 1037 Magic Coupon(25分)【贪心】
The magic shop in Mars is offering some magic coupons. Each coupon has an integer NNN printed on it, meaning that when you use this coupon with a product, you may get NNN times the value of that produ...
2019-12-28 15:49:31 160
原创 PAT (Advanced Level) Practice 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 one tes...
2019-12-28 14:59:58 154
原创 PAT (Advanced Level) Practice 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 ...
2019-12-24 13:36:24 193
原创 PAT (Advanced Level) Practice 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 AAA and BBB, we say that AAA and BBB is related. The weight of a relation is defined...
2019-12-24 13:22:03 221 1
原创 PAT (Advanced Level) Practice 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...
2019-12-20 15:26:41 120
原创 PAT (Advanced Level) Practice 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,...
2019-12-20 14:09:17 188
原创 PAT (Advanced Level) Practice 1031 Hello World for U(20分)【模拟】
Given any string of N(≥5)N (≥5)N(≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as:h de ll rlowoThat is, the characters must ...
2019-12-09 14:04:14 135
原创 PAT (Advanced Level) Practice 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...
2019-12-06 14:07:45 110
原创 PAT (Advanced Level) Practice 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...
2019-12-06 13:52:36 153
原创 PAT (Advanced Level) Practice 1028 List Sorting(25分)【排序】
Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification:Each input file contains one test case. For each case, the first line contains two i...
2019-12-05 16:34:37 127
原创 PAT (Advanced Level) Practice 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...
2019-12-05 16:19:38 106
原创 PAT (Advanced Level) Practice 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...
2019-12-04 15:25:41 145
原创 PAT (Advanced Level) Practice 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...
2019-12-04 13:37:48 120
原创 PAT (Advanced Level) Practice 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...
2019-12-03 14:34:42 123
原创 PAT (Advanced Level) Practice 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...
2019-12-03 13:20:59 425
原创 PAT (Advanced Level) Practice 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...
2019-12-02 15:50:13 136
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人