自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 PAT (Advanced Level) Practice 1085 Perfect Sequence(25分)【二分查找、双指针】

Given a sequence of positive integers and another positive integer ppp. The sequence is said to be a perfectsequenceperfect sequenceperfectsequence if M≤m×pM≤m×pM≤m×p where MMM and mmm are the maximum...

2020-02-14 13:41:02 208

原创 PAT (Advanced Level) Practice 1084 Broken Keyboard(20分)【字符串】

On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a string that you are supposed to ...

2020-02-14 13:23:00 163

原创 PAT (Advanced Level) Practice 1083 List Grades(25分)【排序】

Given a list of NNN student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grade...

2020-02-14 13:10:30 205

原创 PAT (Advanced Level) Practice 1082 Read Number in Chinese(25分)【字符串】

Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For example, -123456789 is read as Fu yi Yi er Qian san Bai ...

2020-02-14 12:59:41 219

原创 PAT (Advanced Level) Practice 1081 Rational Sum(20分)【数学:分数】

Given NNN rational numbers in the form numerator/denominator, you are supposed to calculate their sum.Input Specification:Each input file contains one test case. Each case starts with a positive int...

2020-02-14 10:29:26 225

原创 PAT (Advanced Level) Practice 1080 Graduate Admission(30分)【排序】

It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could write a program to automate the admission...

2020-02-13 22:34:02 184

原创 PAT (Advanced Level) Practice 1079 Total Sales of Supply Chain(25分)【树的遍历、BFS/DFS】

A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the...

2020-02-13 21:20:29 151

原创 PAT (Advanced Level) Practice 1078 Hashing(25分)【哈希】

The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is defined to be H(key)=keyH(key...

2020-02-10 23:25:15 170

原创 PAT (Advanced Level) Practice 1077 Kuchiguse(20分)【字符串】

The Japanese language is notorious for its sentence ending particles. Personal preference of such particles can be considered as a reflection of the speaker’s personality. Such a preference is called ...

2020-02-10 22:41:06 170

原创 PAT (Advanced Level) Practice 1076 Forwards on Weibo(30分)【图的遍历、BFS】

Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a ...

2020-02-10 22:26:54 162

原创 PAT (Advanced Level) Practice 1075 PAT Judge(25分)【排序】

The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Specification:Each input file cont...

2020-02-10 21:53:59 209

原创 PAT (Advanced Level) Practice 1074 Reversing Linked List(25分)【链表】

Given a constant KKK and a singly linked list LLL, you are supposed to reverse the links of every KKK elements on LLL. For example, given LLL being 1→2→3→4→5→61→2→3→4→5→61→2→3→4→5→6, if K=3K=3K=3, the...

2020-02-08 19:38:40 159

原创 PAT (Advanced Level) Practice 1073 Scientific Notation(20分)【字符串】

Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9].[0-9]+E[+-][0-9]+ which means that the inte...

2020-02-08 18:42:51 131

原创 PAT (Advanced Level) Practice 1072 Gas Station(30分)【最短路径】

A gas station has to be built at such a location that the minimum distance between the station and any of the residential housing is as far away as possible. However it must guarantee that all the hou...

2020-02-08 17:43:53 408

原创 PAT (Advanced Level) Practice 1071 Speech Patterns(25分)【字符串】

People often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “the cops”. Analyzing such patterns can help to narrow down a speaker...

2020-02-08 17:04:19 167

原创 PAT (Advanced Level) Practice 1070 Mooncake(25分)【贪心】

Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region’s culture. Now ...

2020-02-07 18:30:10 178

原创 PAT (Advanced Level) Practice 1069 The Black Hole of Numbers(20分)【字符串】

For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasing order, a new number can be obtained by takin...

2020-02-07 18:19:27 197

原创 PAT (Advanced Level) Practice 1068 Find More Coins(30分)【动态规划:01背包】

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,...

2020-02-07 18:00:29 346 1

原创 PAT (Advanced Level) Practice 1067 Sort with Swap(0, i)(25分)【贪心】

Given any permutation of the numbers {0, 1, 2,…, N−1N−1N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allowed to use? For example, to sort {4, ...

2020-02-07 13:01:42 244

原创 PAT (Advanced Level) Practice 1066 Root of AVL Tree(25分)【平衡二叉树AVL】

An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is...

2020-02-07 10:08:36 184

原创 PAT (Advanced Level) Practice 1065 A+B and C (64bit)(20分)

Given three integers AAA, BBB and CCC in [−263,263][−2^{63},2^{63}][−263,263], you are supposed to tell whether A+B>CA+B>CA+B>C.Input Specification:The first line of the input gives the pos...

2020-02-07 10:07:11 216

原创 PAT (Advanced Level) Practice 1064 Complete Binary Search Tree(30分)【二叉搜索树BST】

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...

2020-02-06 21:05:08 145

原创 PAT (Advanced Level) Practice 1063 Set Similarity(25分)【set、查询】

Given two sets of integers, the similarity of the sets is defined to be Nc/Nt×100%N_c/N_t×100\%Nc​/Nt​×100%, where NcN_cNc​ is the number of distinct common numbers shared by the two sets, and NtN_tNt...

2020-02-06 20:36:10 143

原创 PAT (Advanced Level) Practice 1062 Talent and Virtue(25分)【排序】

About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people’s talent and virtue. According to his theory, a man being outstanding in both talent and virt...

2020-02-04 16:52:34 207

原创 PAT (Advanced Level) Practice 1061 Dating(20分)【字符串】

Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that those strange strings...

2020-02-04 16:24:09 554

原创 PAT (Advanced Level) Practice 1060 Are They Equal(25分)【字符串】

If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×1050.123×10^50.123×105 with simple chopping. Now given the ...

2020-02-04 14:15:13 162

原创 PAT (Advanced Level) Practice 1059 Prime Factors(25分)【数学:素数】

Given any positive integer NNN, you are supposed to find all of its prime factors, and write them in the format N=p1k1×p2k2×⋯×pmkmN=p_1^{k_1}×p_2^{k_2}×⋯×p_m^{k_m}N=p1k1​​×p2k2​​×⋯×pmkm​​.Input Speci...

2020-02-04 12:20:39 184

原创 PAT (Advanced Level) Practice 1058 A+B in Hogwarts(20分)

If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a Galleon and twenty-nine Knuts to a Sic...

2020-02-03 17:11:37 234

原创 PAT (Advanced Level) Practice 1057 Stack(30分)【树状数组】

Stack is one of the most fundamental data structures, which is based on the principle of Last In First Out (LIFO). The basic operations include Push (inserting an element onto the top position) and Po...

2020-02-03 16:51:58 152

原创 PAT (Advanced Level) Practice 1056 Mice and Rice(25分)【排序、排名】

Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice...

2020-02-03 12:59:40 170 1

原创 PAT (Advanced Level) Practice 1055 The World's Richest(25分)【排序】

Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate this job, but concentrate only on the peopl...

2020-02-03 11:05:36 171

空空如也

空空如也

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

TA关注的人

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