自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(27)
  • 收藏
  • 关注

原创 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 subtree of a node contains only nodes with keys greater th

2020-08-31 18:21:07 405

原创 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 gamblers by performing inadequate shuffles, many casinos employ

2020-08-30 09:33:29 338

原创 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,]. The first one who bets on a unique number wins. For example, if there are 7 people bet

2020-08-29 10:27:28 130

原创 1040 Longest 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-string iss PAT&TAP s, hence you must output11.Input Specification:Each input file c...

2020-08-28 09:51:26 135

原创 C/C++中map和set嵌套使用

边用边记录,所以不断更新中......map和set嵌套使用1.头文件#include<map>#include<set>2.定义例如string和set<int>键值对:map<string,set<int> >temp;3.插入值4.遍历set

2020-08-27 16:02:32 2694 2

原创 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 for a query.Input Specification:Each input file cont

2020-08-27 15:37:45 200

原创 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-87 or 0229-32-87-321-3214 with respect to different ord

2020-08-26 09:25:46 99

原创 1037 Magic 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 the value of that product back! What is more, the shop also offers some bonus produ...

2020-08-25 10:02:16 105

原创 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 test case. Each case contains a positive integerN, follo.

2020-08-24 09:47:06 188

原创 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 distinguish1(one) froml(Lin lowercase), or0(zero) fromO(oin uppercase). One ...

2020-08-23 09:40:17 125

原创 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 betweenAandB, we say thatAandBis related. The weight of a relation is defined to be the total time length of all the phone calls made between...

2020-08-22 11:20:44 124

原创 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 gas station may give different price. You are asked to car

2020-08-19 15:25:32 122

原创 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,loadingandbeingare stored as showed in Figure 1....

2020-08-18 10:43:02 96

原创 1031 Hello 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 is, the characters must be printed in the original order, starting top-down from the le...

2020-08-17 10:48:49 82

原创 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 between his/her starting city and the destination. If suc

2020-08-16 17:14:32 153

原创 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 median of two sequences is defined to be the me

2020-08-15 09:07:03 199

原创 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 integersN(≤10​^5​​) andC, whereNis the number of r...

2020-08-14 10:46:46 95

原创 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 forRed, the middle 2 digits forGreen, and the last 2 digits forBlue. The only ...

2020-08-13 15:35:53 108

原创 1026 Table Tennis (30分)测试点5没过

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 available table with the smallest number. If all the tables

2020-08-12 22:41:20 268

原创 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 will be merged immediately after the test. Now it is your

2020-08-10 10:03:09 99

原创 1024 Palindromic 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 numbers are palindromic numbers.Non-palindromic numbers can be paired with palindromi.

2020-08-09 09:49:33 126

原创 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 consisting exactly the numbers from 1 to 9, only in a diffe

2020-08-08 09:13:35 119

原创 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 as its ID. Given any query from a reader, you are suppose

2020-08-07 15:12:24 79

原创 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 is calledthe deepest root.Input Specification:Each .

2020-08-06 15:57:20 332

原创 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 corresponding binary tree.Input Specification:Each inpu

2020-08-05 11:14:33 129

原创 1019 General Palindromic Number (20分)

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 numbers are palindromic numbers.Although palindromic numbers are most often considere.

2020-08-04 10:20:13 176

原创 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 city.The Public Bike Management Center (PBMC) keeps mo

2020-08-03 22:01:27 134

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除