自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(66)
  • 资源 (1)
  • 收藏
  • 关注

原创 PAT甲级刷题之路--题目索引+知识点分析(正在进行)

PAT甲级题目汇总+知识点分析,持续更新中

2022-03-01 16:06:52 515

原创 Centos安装Docker

docker-ce为社区版,docker-ee为企业版,这里我们安装docker-ce社区版。yum中默认的Docker镜像地址是国外的,我们换成国内阿里云镜像,快一些。DockerHub地址:https://hub.docker.com。安装环境:CentOS 7.6。更新yum软件包索引。

2022-10-19 12:25:11 325 1

原创 一些特殊SQL使用Mybatis的#{}和${}注意点

Mybatis对JDBC进行了进一步封装,使得我们可以更加便捷的使用Java操作数据库。#{}和${}在大部分情况下,#{}和${}都能相互替代,使用两者之一即可,更加推荐使用#{},因为可以防止SQL注入问题,但是由于#{}和${}本质上的不同,部分SQL语句使用#{}和${}需要格外注意。

2022-10-18 13:20:00 1986

原创 JDBC连接Mysql的五种方式

JDBC连接MySql的五种姿势

2022-10-17 22:48:52 8848

原创 1064 Complete Binary Search Tree(30分)-PAT甲级

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 great

2022-05-31 16:50:30 130

原创 1038 Recover the Smallest Number(30分)-PAT甲级

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 diffe

2022-05-31 16:33:47 100

原创 1045 Favorite Color Stripe(30分)-PAT甲级

Eva is trying to make her own color stripe(条纹) out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts together to form her favorite color stripe.It is

2022-05-28 11:09:11 151

原创 1065 A+B and C (64bit)-PAT甲级

Given three integersA,BandCin (−263,263), you are supposed to tell whetherA+B>C.Input Specification:The first line of the input gives the positive number of test cases,T(≤10). ThenTtest cases follow, each consists of a single line containi...

2022-05-15 22:06:10 217

原创 1066 Root of AVL Tree-PAT甲级

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 done to restore this property. Figures 1-4 illustrate t

2022-05-14 22:07:02 141

原创 二叉平衡树(AVL树)

最近学习了二叉平衡树(AVL树),记录如下。AVL树插入情况汇总树型 判定条件(BF代表平衡因子) 调整方法 LL BF(root)=2,BF(root->lchild)=1 对root进行右旋 LR BF(root)=2,BF(root->lchild)=-1 先对root->lchild进行左旋,再对root进行右旋 RR BF(root)=-2,BF(root->rchild)=-1 对root进行左旋 R

2022-04-22 19:15:31 306

原创 1055 The World‘s Richest (25 分)-PAT甲级

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 people in a certain range of ages. That is, given the net wor

2022-04-08 20:09:25 467

原创 1053 Path of Equal Weight (30 分)-PAT甲级

Given a non-empty tree with rootR, and with weightWi​assigned to each tree nodeTi​. Theweight of a path fromRtoLis defined to be the sum of the weights of all the nodes along the path fromRto any leaf nodeL.Now given any weighted tree, you ar...

2022-04-08 19:10:21 253

原创 1048 Find Coins (25 分)-PAT甲级

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, there was a special requirement of the payment: for eac

2022-04-06 23:00:32 432

原创 1046 Shortest Distance (20 分)-PAT甲级

The task is really simple: givenNexits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file contains one test case. For each case, the first line contain..

2022-04-06 22:40:38 194

原创 1047 Student List for Course (25 分)-PAT甲级

Zhejiang University has 40,000 students and provides 2,500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses.Input Specification:Each input file contains one test case. F

2022-04-06 16:39:29 1187

原创 1029 Median (25 分)-PAT甲级

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

2022-04-06 15:50:57 184

原创 1057 Stack (30 分)-PAT甲级

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 Pop (deleting the top element). Now you are supposed to im

2022-04-05 21:52:26 292 1

原创 704. 二分查找-LeetCode (二分查找模板)

给定一个n个元素有序的(升序)整型数组nums 和一个目标值target ,写一个函数搜索nums中的 target,如果目标值存在返回下标,否则返回 -1。示例 1:输入: nums = [-1,0,3,5,9,12], target = 9输出: 4解释: 9 出现在 nums 中并且下标为 4示例2:输入: nums = [-1,0,3,5,9,12], target = 2输出: -1解释: 2 不存在 nums 中因此返回 -1提示:你可以假设 ...

2022-03-29 16:02:24 393

原创 20. 有效的括号-LeetCode (栈)

给定一个只包括 '(',')','{','}','[',']' 的字符串 s ,判断字符串是否有效。有效字符串需满足:左括号必须用相同类型的右括号闭合。左括号必须以正确的顺序闭合。示例 1:输入:s = "()"输出:true示例2:输入:s = "()[]{}"输出:true示例3:输入:s = "(]"输出:false示例4:输入:s = "([)]"输出:false示例5:输入:s = "{[]}"输出:true提示:1 &l...

2022-03-29 15:48:13 847

原创 1044 Shopping in Mars (25 分)-PAT甲级

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 for only once and some of the diamonds are taken off the

2022-03-24 22:20:31 602

原创 1051 Pop Sequence (25 分)-PAT甲级

Given a stack which can keepMnumbers at most(至多). PushNnumbers in the order of 1, 2, 3, ...,Nand pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, ifMis 5 andNis 7, we can ...

2022-03-22 22:10:56 194

原创 1043 Is It a Binary Search Tree (25 分)-PAT甲级

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 key

2022-03-22 17:11:27 1031

原创 1058 A+B in Hogwarts (20 分)-PAT甲级

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 Sickle, it's easy enough." Your job is to write a program

2022-03-20 16:37:56 356

原创 1054 The Dominant Color (20 分)-PAT甲级

Behind the scenes(场景) in the computer's memory(内存), color is always talked about as a series of 24 bits of information for each pixel(像素). In an image, the color with the largest proportional area(比例面积) is called the dominant(占优势的、占主导地位的) color. Astrictly.

2022-03-20 16:12:45 362

原创 1052 Linked List Sorting (25 分)-PAT甲级

A linked list consists of a series of structures, which are not necessarily adjacent in memory(在内存中相邻). We assume that each structure contains an integerkeyand aNextpointer to the next structure. Now given a linked list, you are supposed to sort the st...

2022-03-20 11:22:35 1032

原创 1040 Longest Symmetric String (25 分)-PAT甲级

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

2022-03-18 11:42:09 247

原创 关于C/C++代码规范的问题

上大学学C/C++也有几个月时间了,这几个月基本都在学基本语法,然后做些题目什么的。做题的时候也贪快,把重心放在代码的实现上去了。看过的C/C++教材也有几本,代码风格各不相同,也没有太在意自己的代码风格,直到今天才发现自己的代码风格实在惨不忍睹,可读性极差,变量命名过于简单,等等。这在实际项目中是致命的,也有因为代码风格过差而在面试中被拒的例子。所以从今天开始,我决定规范自己的代码风格,学习Google C/C++代码规范。以下是一些优秀的教程,值得我去学习,同时我也将它们分享给所需要的...

2022-03-16 22:46:13 489

原创 1034 Head of a Gang (30 分)-PAT甲级

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

2022-03-15 11:52:03 380

原创 1022 Digital Library (30 分)-PAT甲级

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

2022-03-14 21:44:13 419

原创 1030 Travel Plan (30 分)-PAT甲级

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 destina

2022-03-12 16:36:46 164

原创 1037 Magic Coupon (25 分)-PAT甲级

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(你可以拿回该产品价值的N倍)! What is more(而且), the shop also...

2022-03-12 15:25:38 197

原创 1039 Course List for Student (25 分)-PAT甲级

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

2022-03-12 09:23:44 88

原创 1013 Battle Over Cities (25 分)-PAT甲级

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 know immediately if we need to repair any other highways to keep the rest of the c

2022-03-09 22:05:31 206

原创 1007 Maximum Subsequence Sum (25 分)-PAT甲级

Given a sequence(序列,数列) ofKintegers {N1​,N2​, ...,NK​}. A continuous(连续的) subsequence is defined to be {Ni​,Ni+1​, ...,Nj​} where1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For exampl...

2022-03-09 16:32:35 202

原创 1003 Emergency (25 分)-PAT甲级

As 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 city and the length of each road between any pair

2022-03-08 22:38:22 133

原创 1004 Counting Leaves (30 分)-PAT甲级

A family hierarchy(等级制度) is usually presented(展现) by a pedigree(族谱) tree. Your job is to count those family members who have no child.Input Specification:Each input file contains one test case. Each case starts with a line containing0<N<100, the.

2022-03-07 12:37:25 217

原创 1021 Deepest Root (25 分)-PAT甲级

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

2022-03-06 17:13:01 577

原创 由先序遍历和中序遍历得到后序遍历和层次遍历(二叉树)

前几天写了1020 Tree Traversals (25 分)-PAT甲级这个题目,明白了如何由二叉树的后序遍历和中序遍历得到先序遍历和层次遍历。受这道题启发,思考了一下如何由二叉树的先序遍历和中序遍历得到后序遍历和层次遍历。思路和由二叉树的后序遍历和中序遍历得到先序遍历和层次遍历一样,只是递归函数的参数和位置有些改动。1.得到后序遍历:我们知道二叉树的先序遍历中第一个为根节点,中序遍历中根节点位置的左右分别为左右子树,根据这个关系,我们可以还原出这个二叉树的结构。又由后序遍历中根节点最后输出,所以

2022-03-03 22:56:04 2215

原创 KMP算法(C++实现)

KMP算法学了半天,自己也敲了半天,终于搞懂了一些,在此做下总结,方便日后复习,也可供读者参考。求next数组vector<int>nex;//nex数组即next数组,因为c++存在同名情况,所以用nex表示 void get_next(string ss)//获取next数组的函数 { /*i指向已匹配字符串的下一个位置 j指向最长公共前后缀的下一个位置 */ int i,j; nex.resize(ss.length());//数组设置为字符串ss的大小 nex

2022-03-02 21:23:40 3711 2

原创 1042 Shuffling Machine (20 分)-PAT甲级

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

2022-03-01 17:11:03 96

Google C++ Style Guide中文.pdf

Google C++ Style Guide中文.pdf

2022-03-16

空空如也

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

TA关注的人

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