自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 牛客网题 中南林业科技大学第十一届程序设计大赛 F

中南林业科技大学第十一届程序设计大赛 F题:得分链接:https://ac.nowcoder.com/acm/contest/910/F来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K64bit IO Format: %lld题目描述给出T 个由O 和X 组成的字符串,统计所有字符的...

2019-07-12 12:40:00 339

原创 洛谷 P1111 修复公路

题目背景A地区在地震过后,连接所有村庄的公路都造成了损坏而无法通车。政府派人修复这些公路。题目描述给出A地区的村庄数,公路是双向的。并告诉你每条公路的连着哪两个村庄,并告诉你什么时候能修完这条公路。问最早什么时候任意两个村庄能够通车,即最早什么时候任意两条村庄都存在至少一条修复完成的道路(可以由多条公路连成一条道路)输入输出格式输入格式:第1行...

2019-07-12 10:52:00 232

原创 51nod 1212 无向图最小生成树

N个点M条边的无向连通图,每条边有一个权值,求该图的最小生成树。输入第1行:2个数N,M中间用空格分隔,N为点的数量,M为边的数量。(2 <= N <= 1000, 1 <= M <= 50000)第2 - M + 1行:每行3个数S E W,分别表示M条边的2个顶点及权值。(1 <= S, E <= N,1 &...

2019-07-12 10:15:00 173

原创 leetcode 1020. Number of Enclaves(飞地的数量)

Given a 2D array A, each cell is 0 (representing sea) or 1 (representing land)A move consists of walking from one land square 4-directionally to another land square, or off the ...

2019-07-11 21:56:00 191

原创 leetcode 547. Friend Circles (python 函数外置)

There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a dir...

2019-07-11 21:45:00 259

原创 leetcode 529. Minesweeper

Let's play the minesweeper game (Wikipedia, online game)!You are given a 2D char matrix representing the game board. 'M'represents an unrevealed mine, 'E' represents an unreveal...

2019-07-11 21:35:00 165

原创 leetcode 733. Flood Fill

An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535).Given a coordinate (sr, sc) representing the startin...

2019-07-11 18:00:00 142

原创 leetcode 804. Unique Morse Code Words

International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-....

2019-07-10 20:14:00 127

原创 leetcode 200. Number of Islands

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vert...

2019-07-09 16:38:00 186

原创 numpy之数组的赋值

在numpy中,有一个方法array(),指的是用来建立一个数组。numpy数组类是ndarray。其中,Numpy数组的赋值是比较方便的,但是也有一些需要注意的地方。一般赋值:1.下面的赋值方式和C++和Java语言类似import numpy as npa = np.zeros((2,5))a[1][2] = 1a[0][4] = 1...

2019-07-09 13:01:00 31297

原创 leetcode 695. Max Area of Island

Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may assume all four edges ...

2019-07-08 20:51:00 124

原创 leetcode 841. Keys and Rooms

There are N rooms and you start in room 0. Each room has a distinct number in 0, 1, 2, ..., N-1, and each room may have some keys to access the next room.Formally, each room i ...

2019-07-08 19:34:00 116

原创 关于如何在jupyter notebook不通过conda就安装某一库

前言:jupyter notebook是一般来说是内置Anacoda的,而Anacoda是一个十分方便的工具,有了它,可以大大减少我们安装需要的第三方库的时间,减少花费我们的精力,不过,我们要想在jupyter notebook安装Anacoda上没有的库时,我们可能会需要conda来帮助安装,不过,这个过程是有点麻烦就是了。我发现了可以利用pip在jupyter notebook来安装。...

2019-07-07 15:33:53 3075

原创 leetcode 199. Binary Tree Right Side View

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.Example:Input: [1,2,3,null,5,null...

2019-07-06 14:35:00 103

原创 leetcode 111. Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.Note: A leaf is a ...

2019-07-06 07:50:00 107

原创 leetcode 107. Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree [...

2019-07-05 19:28:00 108

原创 leetcode 102. Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7], 3...

2019-06-23 08:43:00 112

原创 leetcode 145. Binary Tree Postorder Traversal

Given a binary tree, return the postorder traversal of its nodes' values.Example:Input: [1,null,2,3] 1 \ 2 / 3Output: [3,2,1]Follow up: Recursive solut...

2019-06-23 07:24:00 131

原创 leetcode 94. Binary Tree Inorder Traversal

Given a binary tree, return the inorder traversal of its nodes' values.Example:Input: [1,null,2,3] 1 \ 2 / 3Output: [1,3,2]Follow up: Recursive solutio...

2019-06-22 07:11:00 95

原创 extend 和 append 的差别

extend和append都是在列表的后面插入元素,功能看起来是一样的,但是,从本质上来看,是不一样的。具体的可以看看下面的代码:a = [1,2,3,4]c = []a.extend(c)print(a)print("a与c的extend后得到的列表的长度:",len(a))输出的结果:[1, 2, 3, 4]a与c的extend后得到...

2019-06-21 22:55:00 165

原创 leetcode 144. Binary Tree Preorder Traversal

Given a binary tree, return the preorder traversal of its nodes' values.Example:Input: [1,null,2,3] 1 \ 2 / 3Output: [1,2,3]Output: [1,2,3]Follow up: ...

2019-06-21 22:39:00 88

原创 leetcode 1. Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you ...

2019-06-21 21:12:00 92

原创 numpy之一些名称含义(持续更新)

这些是我在学numpy的过程中获得的一些总结dtype:data type 数据类型ndarray:n-dimension n维,ndarray:n维数组(多维数组)mean:平均值std:standard deviation:标准差prod:product:乘积revel :与flatten相同,flatten:展平,即将数组展平。不过flatten函数会请求分配内存保存结果...

2019-05-31 10:09:00 656

原创 用Pyquery重写崔庆才的《Python3网络爬虫开发实战》的猫眼爬取(正则表达式不会用。。。。)...

目前正在学Python爬虫,正在读崔庆才的《Python3网络爬虫开发实战》,之前学习正则表达式,但是由于太难,最后放弃了(学渣的眼泪。。。。),在这本书上的抓取猫眼电影排行上,后来自学了pyquery,发现用pyquery可以解决这个问题,目前自己试着写了代码附上代码:import requestsfrom pyquery import PyQuery as pqimport ti...

2019-05-31 09:58:09 505

原创 结尾非零数的奇偶性(问题来源于PythonTip)

给你一个正整数列表 L, 判断列表内所有数字乘积的最后一个非零数字的奇偶性。如果为奇数输出1,偶数则输出0.。例如:L=[2,8,3,50]则输出:0L = [2,8,3,50]c2 = 0c5 = 0for i in L: while i % 2==0: c2+=1 i/=2 while i%5==0: c5+=1 ...

2019-05-24 21:33:00 265

原创 bin内置函数

光棍们对1总是那么敏感,因此每年的11.11被戏称为光棍节。小Py光棍几十载,光棍自有光棍的快乐。让我们勇敢地面对光棍的身份吧,现在就证明自己:给你一个整数a,数出a在二进制表示下1的个数,并输出。例如:a=7则输出:3a = 7n = 0for i in bin(a): if i == '1': n+=1print(n)bin() 返回一个整数 i...

2019-05-24 21:33:00 248

原创 结尾0的个数(问题来源PythonTip)

给你一个正整数列表 L, 输出L内所有数字的乘积末尾0的个数。(提示:不>要直接相乘,数字很多,相乘得到的结果可能会很大)。例如: L=[2,8,3,50],则输出:2利用2 和 5思路:算各个数的素因数里面有几个2和5加起来取min就是0的个数一对2 和5就是10L = [2,8,3,50]c2 = 0c5 = 0for i in L:...

2019-05-24 21:31:00 368

原创 求解100以内的所有素数(问题来自PythonTip)

求解100以内的所有素数(AC/Submit)Ratio(4615|22542)20.47% 描述:输出100以内的所有素数,素数之间以一个空格区分(注意,最后一个数字之后不能有空格)。a=[2]for i in range(3,101): flag=0 for j in range(2,i): if(i%j==0): f...

2019-05-24 21:29:00 480

原创 求矩形面积(问题来自PythonTip)

描述:已知矩形长a,宽b,输出其面积和周长,面积和周长以一个空格隔开。例如:a = 3, b = 8则输出:24 22方法一:a=int(input('')) //input返回的是字符串类型。b=int(input(''))print(str(a*b)+' '+str(2*(a+b)))输入/输出示例:414方法二:a=int(input(''))b=i...

2019-05-24 21:28:00 8352 1

原创 序列判断

给你一个整数组成的列表L,按照下列条件输出:若L是升序排列的,则输出"UP";若L是降序排列的,则输出"DOWN";若L无序,则输出"WRONG"。L = [4,3,1]#这是自己随便写的。if sorted(L) == L: print('UP')elif sorted(L) == list(reversed(L)): print('DOWN')else:...

2019-05-24 21:26:00 325

空空如也

空空如也

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

TA关注的人

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