自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Python 多进程模块 multiprocessing - 简单使用

python, 多进程,multiprocessing

2022-10-30 15:04:08 228 1

原创 Python 常用时间处理模块之time

Python,time模块,时间格式处理,时间戳

2022-10-28 15:39:33 613 1

原创 5 互斥量概念、用法、死锁演示及解决详解

5 互斥量概念、用法、死锁演示及解决详解文章目录5 互斥量概念、用法、死锁演示及解决详解5.1 互斥量(mutex)的基本概念5.2 互斥量的用法5.2.1 lock(), unlock()代码5-2-1运行结果5.2.2 std::lock_guard类模版代码5-2-2运行结果代码5-2-3运行结果5.3 死锁5.3.1 死锁的演示代码5-3-1运行结果5.3.2 死锁的一般解决方案5.3....

2020-03-22 20:59:16 391

原创 2 线程启动、结束,创建线程方法,join、detach

2 线程启动、结束,创建线程方法,join、detach文章目录2 线程启动、结束,创建线程方法,join、detach2.1 范例演示线程运行的开始和结束代码2-1-1运行结果2.1.1 居然直接报错了,这是为什么呢?2.1.2 “秀儿”的解决方法代码2-1-2运行结果2.1.3 如何解决报错问题,利用detach()代码2-1-3运行结果2.1.5 有时候有,有时候无这是为什么呢?2.1....

2020-03-22 13:40:12 252

原创 Python shutil模块常用函数详解

Python shutil模块常用函数详解文章目录Python shutil模块常用函数详解目录及文件操作copyfileobj(*fsrc, fdst*[*, length*])copyfile(*src, dst, \*, follow_symlinks=True*)copymode(*src, dst, \*, follow_symlinks=True*)copystat(*src, ds...

2020-03-20 22:35:23 917

原创 Python os模块常用函数详解

Python os模块常用函数详解文章目录Python os模块常用函数详解判断:文件名操作:文件操作:路径操作:目录操作:表现形式参数:系统操作:判断:os.path.exists(path) # 判断path是否存在,存在返回True,不存在返回Falseos.path.isfile(path) # 判断path是否为文件,是返回True,不是返回Falseos.path.isd...

2020-03-20 22:19:49 302 1

原创 CCF认证刷题-201412-2-Z字形扫描

分析:​ 这道题的难点主要是控制边界,观察题目给的路径可以看出,有两个扫描的方向,斜向上与斜向下,我这里用enumenumenum类型变量存储方向,初始点为(0,0)(0,0)(0,0),方向为斜向上,先打印出访问的点,再尝试着根据当前扫描的方向前进,后面444个条件判断语句分别控制扫描出错及改正的策略。/* * @Descripttion: * @version: *...

2020-03-20 15:35:16 118

原创 LeetCode刷题-206. Reverse Linked List(反转链表)

反转一个单链表。示例:输入: 1->2->3->4->5->NULL输出: 5->4->3->2->1->NULL进阶:你可以迭代或递归地反转链表。你能否用两种方法解决这道题?解法一:逆序可以考虑堆栈,先遍历整个链表,并同时把元素pushpushpush进堆栈,然后poppoppop出来构造出新的链表即反转后的链表,时间复...

2020-03-19 22:07:58 156

原创 面试题 01.07. 旋转矩阵

给定一幅由N × N矩阵表示的图像,其中每个像素的大小为4字节,编写一种方法,将图像旋转90度。不占用额外内存空间能否做到?示例 1:给定 matrix = [ [1,2,3], [4,5,6], [7,8,9]],原地旋转输入矩阵,使其变为:[ [7,4,1], [8,5,2], [9,6,3]]示例 2:给定 matrix =...

2020-03-19 17:34:53 456

原创 54. 螺旋矩阵

给定一个包含mxn个元素的矩阵(m行,n列),请按照顺时针螺旋顺序,返回矩阵中的所有元素。示例1:输入:[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ]]输出: [1,2,3,6,9,8,7,4,5]示例2:输入:[ [1, 2, 3, 4], [5, 6, 7, 8], [9,10,11,12]]...

2020-03-19 16:42:08 112

原创 A1035 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(L...

2020-03-19 13:49:28 125

原创 A1034 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 t...

2020-03-18 22:35:13 205

原创 A1033 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 ga...

2020-03-18 22:33:59 103

原创 A1032 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,...

2020-03-18 22:32:33 114

原创 A1031 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 prin...

2020-03-18 22:31:11 90

原创 A1030 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 b...

2020-03-18 22:29:59 120

原创 A1028 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...

2020-03-18 22:28:33 95

原创 A1027 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 dig...

2020-03-18 22:27:02 82

原创 3 由Partition&荷兰国旗问题引出的快速排序(QuickSort)

由Partition&荷兰国旗问题引出的快速排序(QuickSort)Partition问题:给定一个数组arrarrarr,和一个数numnumnum,请把小于numnumnum的数放在数组的左边,大于numnumnum的数放在数组的右边。需要额外空间复杂度为 O(1)O(1)O(1) ,时间复杂度O(N)O(N)O(N)。Solution:void swap(int arr[]...

2020-03-18 22:19:08 136

原创 2 由分治(Divide&Conquer)通向归并排序(MergeSort)

由分治(Divide&Conquer)通向归并排序(MergeSort)一个求数组中的最大值的分治实现:/* * @Descripttion: * @version: * @Author: iDestro * @Date: 2020-03-17 20:23:45 * @LastEditors: iDestro * @LastEditTime: 2020-03-17 20...

2020-03-18 22:17:11 114

原创 A1025 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 w...

2020-03-18 09:50:08 88

原创 A1022 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 numbe...

2020-03-17 22:41:57 119

原创 A1021 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 ...

2020-03-17 22:38:25 102

原创 A1020 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 cor...

2020-03-17 22:37:18 81

原创 A1019 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...

2020-03-17 22:36:05 120

原创 A1018 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 ...

2020-03-17 22:34:18 164

原创 A1015 Reversible Primes (20分)

Areversible primein 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 pr...

2020-03-17 22:32:43 72

原创 A1013 Battle Over Cities (25分)

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

2020-03-17 22:31:19 102

原创 A1012 The Best Rank (25分)

To evaluate the performance of our first year CS majored students, we consider their grades of three courses only:C- C Programming Language,M- Mathematics (Calculus or Linear Algrbra), andE- Eng...

2020-03-17 22:30:01 82

原创 A1011 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. Si...

2020-03-17 15:45:39 117

原创 More Effective C++ 基础议题(Basics)

基础议题条款1:仔细区别pointers和references​ 没有所谓的null reference,但可以有null pointer,这个事实意味着使用reference可能会比使用pointers更有效率(不需要测试其有效性)。因此,让我做下结论:当你知道你需要指向某个东西,而且绝不会改变其他东西,或是当你实现一个操作符而其语法需求由pointers达成,你就应该选择reference...

2020-03-17 15:43:24 153

原创 A1010 Radix (25分)

Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer isyes, if 6 is a decimal number and 110 is a binary number.Now for any pair of positive inte...

2020-03-16 23:43:54 103

原创 A1009 Product of Polynomials (25分)

This time, you are supposed to findA×BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa...

2020-03-16 23:42:46 89

原创 A1008 Elevator (20分)

The highest building in our city has only one elevator. A request list is made up withNpositive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec...

2020-03-16 23:41:26 192

原创 A1007 Maximum Subsequence Sum (25分)

Given a sequence ofKintegers {N​1​​,N​2​​, ...,N​K​​}. A continuous subsequence is defined to be {N​i​​,N​i+1​​, ...,N​j​​} where1≤i≤j≤K. The Maximum Subsequence is the continuous subsequen...

2020-03-16 23:38:54 84

原创 A1006 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...

2020-03-16 23:37:54 91

原创 A1005 Spell It Right (20分)

Given a non-negative integerN, your task is to compute the sum of all the digits ofN, and output every digit of the sum in English.Input Specification:Each input file contains one test case. Eac...

2020-03-16 23:36:39 89

原创 A1004 Counting Leaves (30分)

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

2020-03-16 23:35:25 147

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

This time, you are supposed to findA+BwhereAandBare two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the informa...

2020-03-16 23:31:57 88

原创 A1001 A+B Format (20分)

Calculatea+band 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 ...

2020-03-16 23:30:42 105

空空如也

空空如也

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

TA关注的人

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