自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 CopyCopy

Copy自卖报小郎君的微信公众号1.我与春风皆过客,你携秋水揽星河。2.你是落日弥漫的橘,天边透亮的星。3.明月照回湖心,野鹤奔向闲云,我步入你。4.世界需要讲道理,但我最偏心你。5.晚是世界的晚,安是你给的安。6.我绕的过江山错落,饶不过你。7.你的眼神再温柔些,月亮会融化,我也会。8.你是四月里的清风入怀,甚是可爱。9.我喜欢你,是那种一想到你的名字,心里动辄海啸山鸣的喜欢。10.风止于水,我止于你。11.思念如马,自别离,未停蹄。12.日为朝,月为暮,卿为朝朝暮暮。13.月遇

2021-06-30 20:43:37 229

原创 KMP学习简略记录

//具体思想就那样,从1开始, nextval[1] = 0 略略略int Index_KMP(String S, String T, int next[]){ int i = 1, j = 0; while (i < T.length) { if (j == 0 || T.ch[i] == S.ch[j]) { ++i; ++j; if (T.ch[i] != T.ch[j]) nextval[i] = j; else nextval[i] = nextval[j];

2021-06-30 20:25:22 96

原创 1006 Sign In and Sign Out (25 分)

1006 Sign In and Sign Out (25 分)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 are supposed to find t

2021-03-13 10:03:37 93

原创 1005 Spell It Right (20 分)

1005 Spell It Right (20 分)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 case occupies one line which

2021-03-13 10:03:31 63

原创 1001 A+B Format (20 分)

#1001 A+B Format (20 分)Calculate a+b and output the sum in standard format – that is, the digits must be separated into groups of three by commas (unless there are less than four digits).Input Specification:Each input file contains one test case. Each c

2021-03-13 10:03:25 47

原创 1002 A+B for Polynomials (25 分)

1002 A+B for Polynomials (25 分)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 information of a polynomial:K N​

2021-03-13 10:03:18 79

原创 1007 Maximum Subsequence Sum (25 分)

1007 Maximum Subsequence Sum (25 分)Given a sequence of K integers { N​1​​ , N​2​​ , …, N​K​​ }. A continuous subsequence is defined to be { N​i​​ , N​i+1​​ , …, N​j​​ } where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the l

2021-03-12 11:00:14 119

原创 1008 Elevator (20 分)

1008 Elevator (20 分)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 seconds to move the elevator up one fl

2021-03-12 10:59:08 47

原创 1009 Product of Polynomials (25 分)

1009 Product of Polynomials (25 分)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 information of a polynomial:K

2021-03-12 10:58:02 54

原创 1010 Radix (25 分)

1010 Radix (25 分)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 integers N​1​​ and N​2​​ , your task is to

2021-03-12 10:55:49 66

原创 1011 World Cup Betting (20 分)

1011 World Cup Betting (20 分)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. Similarly, football betting

2021-03-12 10:54:49 37

原创 1014 Waiting in Line (30 分)

1014 Waiting in Line (30 分)Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The space inside the yellow line in fr

2021-03-12 10:53:38 57

原创 1015 Reversible Primes (20 分)

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 prime.Now given any two pos

2021-03-12 10:51:05 47

原创 1016 Phone Bills (25 分)

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. When a customer starts connecting a l

2021-03-12 10:49:55 37

原创 1017 Queueing at Bank (25 分)

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 line, until it is his/her tur

2021-03-12 10:48:47 58

原创 1018 Public Bike Management (30 分)

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

2021-03-12 10:47:37 72

原创 PAT(甲级)2019年冬季考试7-2 Block Reversing (25 分)

7-2 Block Reversing (25 分)Given a singly linked list L. Let us consider every K nodes as a block (if there are less than K nodes at the end of the list, the rest of the nodes are still considered as a block). Your job is to reverse all the blocks in L. Fo

2021-03-11 00:55:39 124

原创 PAT(甲级)2019年冬季考试7-3 Summit (25 分)

7-3 Summit (25 分)A summit (峰会) is a meeting of heads of state or government. Arranging the rest areas for the summit is not a simple job. The ideal arrangement of one area is to invite those heads so that everyone is a direct friend of everyone.Now given

2021-03-11 00:55:29 90

原创 PAT(甲级)2019年秋季考试7-1 Forever (20 分)

7-1 Forever (20 分)“Forever number” is a positive integer A with K digits, satisfying the following constrains:the sum of all the digits of A is m;the sum of all the digits of A+1 is n; andthe greatest common divisor of m and n is a prime number which i

2021-03-11 00:55:15 185 1

原创 PAT(甲级)2019年秋季考试7-3 Postfix Expression (25 分)

7-3 Postfix Expression (25 分)Given a syntax tree (binary), you are supposed to output the corresponding postfix expression, with parentheses reflecting the precedences of the operators.Input Specification:Each input file contains one test case. For each

2021-03-11 00:55:07 109

原创 PAT(甲级)2019年秋季考试7-4 Dijkstra Sequence (30 分)

7-4 Dijkstra Sequence (30 分)Dijkstra’s algorithm is one of the very famous greedy algorithms. It is used for solving the single source shortest path problem which gives the shortest paths from one particular source vertex to all the other vertices of the

2021-03-11 00:54:58 128

原创 PAT(甲级)2019年秋季考试7-2 Merging Linked Lists (25 分)

7-2 Merging Linked Lists (25 分)Given two singly linked lists L​1​​ =a​1​ →a​2​​ →⋯→a​n−1​​ →a​n​​ and L​2​ =b​1​​ →b​2​​ →⋯→b​m−1​​ →b​m​​ . If n≥2m, you are supposed to reverse and merge the shorter one into the longer one to obtain a list like a​1​​ →a

2021-03-11 00:54:48 161

原创 PAT(甲级)2019年冬季考试7-1 Good in C (20 分)

7-1 Good in C (20 分)When your interviewer asks you to write “Hello World” using C, can you do as the following figure shows?Input Specification:Each input file contains one test case. For each case, the first part gives the 26 capital English letters A

2021-03-10 14:49:57 143

原创 PAT(甲级)2019年冬季考试7-4 Cartesian Tree (30 分)

7-4 Cartesian Tree (30 分)A Cartesian tree is a binary tree constructed from a sequence of distinct numbers. The tree is heap-ordered, and an inorder traversal returns the original sequence. For example, given the sequence { 8, 15, 3, 4, 1, 5, 12, 10, 18,

2021-03-10 14:43:49 129

原创 PAT(甲级)2020年春季考试7-1 Prime Day (20 分)

7-1 Prime Day (20 分)The above picture is from Sina Weibo, showing May 23rd, 2019 as a very cool “Prime Day”. That is, not only that the corresponding number of the date 20190523 is a prime, but all its sub-strings ended at the last digit 3 are prime numb

2021-03-10 11:00:45 85

原创 PAT(甲级)2020年春季考试7-2 The Judger (25 分)

7-2 The Judger (25 分)A game of numbers has the following rules: at the beginning, two distinct positive integers are given by the judge. Then each player in turn must give a number to the judge. The number must be the difference of two numbers that are pr

2021-03-10 11:00:36 108

原创 PAT(甲级)2020年春季考试7-3 Safari Park (25 分)

7-3 Safari Park (25 分)A safari park(野生动物园)has K species of animals, and is divided into N regions. The managers hope to spread the animals to all the regions, but not the same animals in the two neighboring regions. Of course, they also realize that this

2021-03-10 11:00:25 117

原创 PAT(甲级)2020年春季考试7-4 Replacement Selection (30 分)

7-4 Replacement Selection (30 分)When the input is much too large to fit into memory, we have to do external sorting instead of internal sorting. One of the key steps in external sorting is to generate sets of sorted records (also called runs) with limited

2021-03-10 11:00:12 390

原创 PAT(甲级)2020年冬季考试7-1 The Closest Fibonacci Number (20分)

7-1The Closest Fibonacci Number(20分)The Fibonacci sequence F​n​​ is defined by F​n+2​​ =F​n+1​​ +F​n​​ for n≥0, with F​0​​ =0 and F​1​​ =1. The closest Fibonacci number is defined as the Fibonacci number with the smallest absolute difference with the gi

2021-03-10 10:59:54 240

原创 PAT(甲级)2020年冬季考试7-2 Subsequence in Substring (25分)

7-2Subsequence in Substring(25分)A substring is a continuous part of a string. A subsequence is the part of a string that might be continuous or not but the order of the elements is maintained. For example, given the string atpaaabpabtt, pabt is a substrin

2021-03-10 10:58:34 397

原创 PAT(甲级)2020年冬季考试7-3 File Path (25分)

7-3File Path(25分)The figure shows the tree view of directories in Windows File Explorer. When a file is selected, there is a file path shown in the above navigation bar. Now given a tree view of directories, your job is to print the file path for any sel

2021-03-10 10:58:22 228 1

原创 PAT(甲级)2020年冬季考试7-4 Chemical Equation (30分)

7-4Chemical Equation(30分)A chemical equation is the symbolic representation of a chemical reaction in the form of symbols and formulae, wherein the reactant entities are given on the left-hand side and the product entities on the right-hand side. For exam

2021-03-10 10:58:07 592 2

原创 1019 General Palindromic Number (20 分)

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

2021-03-09 11:18:30 35

原创 1020 Tree Traversals (25 分)

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

2021-03-09 11:16:10 35

原创 1021 Deepest Root (25 分)

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 called the deepest root.Inp

2021-03-09 11:15:34 50

原创 1022 Digital Library (30 分)

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 fr

2021-03-09 11:14:37 41

原创 1023 Have Fun with Numbers (20 分)

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 nu

2021-03-09 11:13:14 42

原创 1024 Palindromic Number (25 分)

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.Non-palindromic numbers

2021-03-09 11:12:30 41

原创 1025 PAT Ranking (25 分)

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

2021-03-09 11:11:14 40

原创 1027 Colors in Mars (20 分)

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 digits for Green, and the last 2

2021-03-09 11:08:52 29

空空如也

空空如也

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

TA关注的人

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