自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 VSCode中为markdown文件添加目录

安装Markdown TOC插件在扩展商店中搜索TOC,安装对应插件在markdow文件中插入目录打开markdown文件,在想要插入的地方单击右键,选择Markdown TOC Insert。出现auto导致目录显示格式问题自动生成的目录换行有问题。点击文件–>首选项–>设置,搜索默认行尾字符,设置为\n即可。...

2020-12-17 13:26:23 3608 2

原创 使用Appinum爬取微信朋友圈

环境配置安装Android SDK安装Appium Serverhttps://bitbucket.org/appium/appium.app/downloads/将下载的 AppiumForWindows.zip 进行解压,点击 appium-installer.exe 进行安装。把安装目录下的**…\Appium\node_modules.bin**添加到系统变量Path后。打开Windows命令提示符,输入appium-doctor,检查所需环境是否satisfied。安装Python

2020-12-17 12:55:21 472

原创 Python将函数作为返回值

函数作为返回值高阶函数除了可以接受函数作为参数外,还可以把函数作为结果值返回。 def lazy_sum(*args): def sum(): ax = 0 for n in args: ax = ax + n retu...

2018-09-27 14:21:28 362

原创 Python学习笔记——sorted

sorted()函数也是一个高阶函数,它还可以接收一个key函数来实现自定义的排序sorted([36, 5, -12, 9, -21], key=abs)要进行反向排序,不必改动key函数,可以传入第三个参数reverse=Truesorted()也是一个高阶函数。用sorted()排序的关键在于实现一个映射函数。 练习:设我们用一组tuple表示学生名字和成绩:L...

2018-09-27 14:02:23 180

转载 Python学习笔记——Python实现字符串反转的几种方法

filter()的作用是从一个序列中筛出符合条件的元素。由于filter()使用了惰性计算,所以只有在取filter()结果的时候,才会真正筛选并每次返回下一个筛出的元素。要求:在Python环境下用尽可能多的方法反转字符串,例如将s = "abcdef"反转成 "fedcba"第一种:使用字符串切片result = s[::-1]第二种:使用列表的reverse方法l =...

2018-09-27 13:49:59 308

原创 Python学习笔记——filter

回数是指从左向右读和从右向左读都是一样的数,例如12321,909。请利用filter()筛选出回数def is_palindrome(n): nn = str(n) return nn == nn[::-1]output = filter(is_palindrome, range(1, 1000))print('1~1000:', list(output))if lis...

2018-09-27 13:49:18 152

原创 Python学习笔记——map/reduce

求list乘积from functools import reducedef prod(L): def multi(x, y): return x * y return reduce(multi, L)print('3 * 5 * 7 * 9 =', prod([3, 5, 7, 9]))if prod([3, 5, 7, 9]) == 945: ...

2018-09-27 13:46:30 227

原创 Python学习笔记——杨辉三角

def yhTriangle(max): N = [1] i = 0 while i < max: yield N N.append(0) N = [N[i - 1] + N[i] for i in range(len(N))] i = i + 1for n in yhTriangle(10):...

2018-09-17 10:41:23 217

原创 Python学习笔记——首字母大写,其余小写

利用切片和字符串拼接def normalize(s): return s[0].upper() + s[1:].lower()L1 = ['adam', 'LISA', 'barT']L2 = list(map(normalize, L1))print(L2) 

2018-09-17 10:39:23 4378

转载 Java I/O 模型的演进

原文 http://www.importnew.com/21383.html 什么是同步?什么是异步?阻塞和非阻塞又有什么区别?本文先从 Unix 的 I/O 模型讲起,介绍了5种常见的 I/O 模型。而后再引出 Java 的 I/O 模型的演进过程,并用实例说明如何选择合适的 Java I/O 模型来提高系统的并发量和可用性。由于,Java 的 I/O 依赖于操作系统的实现,所以先了...

2018-07-18 13:40:47 106

原创 Java高级编程笔记1——数据类型,数组,运算符

编译器 javac运行 java数据类型:基本数据类型,对象类型。{ 基本数据类型:char boolean byte short int long float double { byte(有符号单字节整型-128~127) 0开头是八进制,0x十六进制 long ll = 123123L; default int float ff = 3.14f; default do...

2018-07-17 08:07:01 165

转载 Unicode,GBK,UTF8区别

转载https://www.cnblogs.com/gavin-num1/p/5170247.html

2018-07-02 09:11:33 828

原创 CPU调度算法C++模拟实现——(FCFS,SJF,RR)

FisrtComeFirstServe——先到先服务算法按照进程进入就绪队列的顺序,来执行进程。用一个队列维护即可。ShortestJobFirst——短作业优先算法我实现的是非抢占shi...

2018-06-13 21:09:10 8954 2

原创 吸烟者问题C++实现

问题描述抽烟者问题。假设一个系统中有三个抽烟者进程,每个抽烟者不断地卷烟并抽烟。抽烟者卷起并抽掉一颗烟需要有三种材料:烟草、纸和胶水。一个抽烟者有烟草,一个有纸,另一个有胶水。系统中还有两个供应者进程,它们无限地供应所有三种材料,但每次仅轮流提供三种材料中的两种。得到缺失的两种材料的抽烟者在卷起并抽掉一颗烟后会发信号通知供应者,让它继续提供另外的两种材料。这一过程重复进行。问题分析1.考虑到:有可...

2018-06-01 21:15:47 3820

原创 codeforces978E Bus Video System

The busses in Berland are equipped with a video surveillance system. The system records information about changes in the number of passengers in a bus after stops.If x is the number of passengers in a...

2018-05-21 09:39:09 348

原创 codeforces978D Almost Arithmetic Progression

Polycarp likes arithmetic progressions. A sequence [a1,a2,…,an] is called an arithmetic progression if for each i (1≤i<n) the value ai+1−ai is the same. For example, the sequences [42], [5,5,5], [2...

2018-05-21 08:21:39 555

原创 codeforces984B Minesweeper

One day Alex decided to remember childhood when computers were not too powerful and lots of people played only default games. Alex enjoyed playing Minesweeper that time. He imagined that he saved worl...

2018-05-19 13:05:57 196

原创 codeforces979B Treasure Hunt——贪心

题目描述After the big birthday party, Katie still wanted Shiro to have some more fun. Later, she came up with a game called treasure hunt. Of course, she invited her best friends Kuro and Shiro to play wi...

2018-05-19 12:52:56 532 1

原创 codeforces979A Pizza, Pizza, Pizza!!

Katie, Kuro and Shiro are best friends. They have known each other since kindergarten. That's why they often share everything with each other and work together on some very hard problems.Today is Shir...

2018-05-19 12:30:07 264

原创 codeforces979C Kuro and Walking Route——深搜

C. Kuro and Walking Routetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputKuro is living in a country called Uberland, consisting of n towns, numbe...

2018-05-19 12:26:01 346

原创 Linux进程间通信——共享内存

相关系统调用1.创建/打开已存在共享内存区——shmget()    shmget(key, size, flag);    返回内存区标识号。2.映射共享内存区和进程虚拟地址空间——shmat()    shmat(id, addr, flag);    返回映射地址。    id:由shmget()返回,用来标识某共享内存区。    addr:用户希望映射到哪块虚拟地址,通常设为NULL。  ...

2018-04-22 19:59:14 135

原创 银行家算法——死锁避免(C++代码实现)

安全状态如果存在一个安全序列,那么系统处于安全状态。对于进程顺序<P1,P2,...,Pn>,有如下            Pi-need <= Pj-hold + All-available则这一顺序为安全序列。可以保证所有进程按此顺序执行后,资源分配不会发生死锁。银行家算法·数据结构1)可利用资源向量Available是个含有m个元素的数组,其中的每一个元素代表一类可利用的资...

2018-04-21 12:45:43 4350

原创 网络流入门——Drainage Ditches POJ1273

问题描述Every time it rains on Farmer John's fields, a pond forms over Bessie's favorite clover patch. This means that the clover is covered by water for awhile and takes quite a long time to regrow. Th...

2018-03-28 08:59:27 125

转载 [转载链接]如何生成均匀随机排列(等概率生成排列)

http://www.cppblog.com/csu-yx-2013/archive/2013/10/09/166565.html随机化算法

2017-07-04 23:59:59 349

原创 NYOJ题目6 喷水装置(一)

#include #include #include #include using namespace std;bool cmp(float a, float b){ return a>b;}int main(){ float a[600]; int m, n; float t, ans; int i; scanf("%d", &

2017-06-24 19:51:23 471

转载 [转载链接]五大常用算法之一:分治法

http://www.cnblogs.com/steven_oyj/archive/2010/05/22/1741370.html

2017-06-23 11:29:47 150

原创 分治法求最大连续和

给出一个长度为n的序列,求连续最大和。递归求解是分别求出位于左半部分和右半部份的最优解。合并是找起点在左边的,终点在右边的最优解,并和左右部分最优的进行比较。代码如下。时间复杂度o(NlogN)int maxsum(int *A, int x, int y){ int middle, value, L, R, mmax; if(y-x == 1

2017-06-23 11:24:56 500

转载 [转载链接]跳跃的舞者,舞蹈链(Dancing Links)算法——求解精确覆盖问题

舞蹈链算法

2017-06-04 07:57:18 341

原创 POJ 1488 TEX Quotes 更换双引号

POJ 1488 字符串

2017-02-18 15:49:26 207

空空如也

空空如也

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

TA关注的人

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