- 博客(204)
- 资源 (1)
- 收藏
- 关注

原创 C++中字符串和数字之间的转换
C++中字符和数字之间的转换文章目录C++中字符和数字之间的转换sscanf 与 sprinfstringstream的使用调用stoi stol 等库函数最近遇到看书和做题遇到的一些关于字符串和数字转化之间的问题,做一个整理。sscanf 与 sprinf具体可以参考《算法笔记》p53页sscanf的使用sscanf 是将字符数组的内容以对应数字形式(也可以是字符串的形式, 本...
2020-02-04 00:40:46
429
原创 PAT Advanced 1099 Build A Binary Search Tree
1099 Build A Binary Search TreeA 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 th...
2020-03-06 21:31:20
253
原创 PAT Advanced 1094 The Largest Generation
1094 The Largest GenerationA family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with th...
2020-03-04 17:12:56
259
原创 PAT Advanced 1102 Invert a Binary Tree
1102 Invert a Binary Tree The following is from Max Howell @twitter:Google: 90% of our engineers use the software you wrote (Homebrew), but you can't invert a binary tree on a whiteboard so fuck o...
2020-03-02 18:02:42
236
原创 PAT Advanced 1051 Pop Sequence
1051 Pop Sequence 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...
2020-02-24 16:30:13
250
原创 PAT Advanced 1086 Tree Traversals Again
1086 Tree Traversals Again An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1...
2020-02-21 10:53:07
156
原创 PAT Advanced 1020 Tree Traversals
1020 Tree Traversals 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 travers...
2020-02-21 10:43:42
198
原创 PAT Advaced 1035 Password
1035 Password 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 (...
2020-02-19 00:13:50
167
原创 PAT Advanced 1110 Complete Binary Tree
1110 Complete Binary Tree Given a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file contains one test case. For each case, the first line gives a p...
2020-02-18 16:48:09
160
原创 PAT Advanced 1006 Sign In and Sign Out
1006 Sign In and Sign Out 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...
2020-02-17 14:57:24
146
原创 PAT Advanced 1025 PAT Ranking
1025 PAT Ranking 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, a...
2020-02-16 16:22:58
174
原创 PAT Advanced 1063 Set Similarity
1063 Set Similarity Given two sets of integers, the similarity of the sets is defined to be N**c/N**t×100%, where N**c is the number of distinct common numbers shared by the two sets, and N**t is th...
2020-02-15 20:58:31
220
原创 PAT Advanced 1083 List Grades
1083 List Grades Given a list of N 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...
2020-02-15 16:35:57
136
原创 PAT Advanced 1069 The Black Hole of Numbers
1069 The Black Hole of Numbers 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 ne...
2020-02-15 16:03:43
251
原创 PAT Advanced 1050 String Subtraction
1050 String Subtraction 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 ...
2020-02-14 22:29:36
167
原创 PAT Advanced 1029 Median
1029 Median 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...
2020-02-05 10:37:26
234
原创 PAT Advanced 1041 Be Unique
1041 Be Unique (20point(s))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]...
2020-02-04 12:06:34
144
原创 PAT Advanced 1001 A+B Format
1001 A+B Format 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 Specificati...
2020-02-04 11:13:27
203
原创 PAT Advanced 1058 A+B in Hogwarts
1058 A+B in HogwartsIf 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 twen...
2020-02-04 10:34:43
224
原创 PAT Advanced 1027 Colors in Mars
1027 Colors in MarsPeople 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 R...
2020-02-04 10:04:59
136
原创 PAT Advanced 1024 Palindromic Number
1024 Palindromic NumberA 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 number...
2020-02-03 21:12:14
125
原创 LeetCode 20 Valid Parenthese
20 Valid ParenthesesGiven a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.An input string is valid if:Open brackets must be closed ...
2020-02-03 16:15:00
163
原创 LeetCode 38 Count and Say
38 Count and SayThe count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11....
2020-02-03 16:06:51
135
原创 PAT Advanced 1036 Boys vs Girls
1036 Boys vs Girls 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 ...
2020-02-03 11:16:34
135
原创 PAT Advanced 1019 General Palindromic Number
1019 General Palindromic Number 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 dig...
2020-02-03 10:08:32
200
原创 PAT Advanced 1015 Reversible Primes
1015 Reversible PrimesA 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 it...
2020-02-02 19:51:09
212
原创 PAT Advanced 1009 Product of Polynomials
1009 Product of Polynomials 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 ea...
2020-02-02 16:57:18
199
1
原创 PAT Advanced 1011 World Cup Betting
1011 World Cup Betting 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 t...
2020-02-02 14:34:07
168
原创 解决git中 push 出现time out无法ping通github的问题
解决git的push 出现time out的问题 无法ping通github放假回家突然发像 git推送不上去东西了 一直打不开困扰了我好几天,终于发现了解决方法 ????✌️git突然出现time out的问题chrome登录不上去:ping不通解决windows下打开文件 文件C:\Windows\System32\drivers\etc\hosts文件C:\Window...
2020-02-02 10:41:47
3597
1
原创 PAT Advanced 1002 A+B for Polynomials
1002 A+B for Polynomials 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 l...
2020-02-01 21:39:07
184
原创 PAT Advanced 1046 Shortest Distance
1046 Shortest Distance (20point(s))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 S...
2020-02-01 19:49:58
304
原创 PAT Advanced 1040 Longest Symmetric String
1040 Longest Symmetric String 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-stri...
2020-01-17 11:43:09
132
原创 PAT Advanced 1007Maximum Subsequence Sum
Maximum Subsequence Sum Given a sequence of K integers { N1, N2, …, 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 continu...
2020-01-17 11:41:07
122
原创 PAT Advanced 1087 All Roads Lead to Rome
1087 All Roads Lead to Rome Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happiness...
2020-01-12 22:56:48
151
原创 PAT Advanced 1018 Public Bike Management
1018 Public Bike Management 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 i...
2020-01-12 09:40:17
134
原创 PAT Advanced 1013 Battle Over Cities
1013 Battle Over Cities It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must k...
2020-01-10 18:27:31
124
原创 PAT Advanced 1030 Travel Plan
1030 Travel Plan 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 t...
2020-01-10 13:52:47
148
原创 PAT Advanced 1003 Emergency
EmergencyAs an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each ci...
2020-01-06 15:29:06
135
原创 银行家的算法实现—全部安全序列求解dfs以及错误分析
银行家算法文章目录银行家算法银行家算法的概述银行家算法代码测试样例代码思路 错误分析运行结果银行家算法的概述银行家算法是一种避免死锁,为不同进程分配资源的,保证不同进程都能分配到资源,最终求出实现资源分配后不同进程运行的序列,此序列称为安全序列, 具体的原理和解释就看书吧~ 我这里将书中的例子写成代码,时间关系目前先不详解啦,在这里给出的代码实现的过程。银行家算法代码#include &...
2019-12-21 00:56:34
2808
原创 PAT Advanced 1008 Elevator
1008 Elevator 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...
2019-11-30 11:13:43
136
全国计算机等级三级 网络技术无纸化考试模拟软件 ,亲测可用(2019.3)
2019-07-24
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人