使用dfs求解全排列

摘要: //借助两个数组,使用dfs输出全排列import java.util.Arrays; public class FullPermutation { private static int [] result;//存放全排列的结果 private static boolean [] visit;//定义一个标记数组 private static int total; //... 阅读全文
posted @ 2018-03-04 12:38 ZhangのBlog 阅读(1379) 评论(0) 推荐(0)

并查集

摘要: 感觉另一位大神的博客写的比较好,所以收藏一下:http://blog.csdn.net/dm_vincent/article/details/7655764 阅读全文
posted @ 2018-02-13 17:41 ZhangのBlog 阅读(92) 评论(0) 推荐(0)

Best Cow Line

摘要: Description FJ is about to take his N (1 ≤ N ≤ 2,000) cows to the annual"Farmer of the Year" competition. In this contest every farmer arranges his co 阅读全文
posted @ 2018-02-08 22:09 ZhangのBlog 阅读(148) 评论(0) 推荐(0)

Saruman's Army

摘要: Description Saruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes 阅读全文
posted @ 2018-02-08 22:05 ZhangのBlog 阅读(116) 评论(0) 推荐(0)

Fence Repair

摘要: Description Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,00 阅读全文
posted @ 2018-02-08 21:56 ZhangのBlog 阅读(107) 评论(0) 推荐(0)

Laking Counting

摘要: Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x M (1 <= N <= 10 阅读全文
posted @ 2018-02-07 19:10 ZhangのBlog 阅读(194) 评论(0) 推荐(0)

淘宝商品定向爬取

摘要: #获取淘宝搜索页面的信息,提取其中商品名称和价格 #理解:获得淘宝的搜索接口 # 翻页的处理 #步骤1:提交商品搜索请求,循环获取网页,首先获得第一页,然后通过循环获得其他页面 #步骤2:对于每个页面,提取商品名称和价格信息 #步骤3:将信息输出到屏幕上 import requests import re def getHTMLText(url): try: ... 阅读全文
posted @ 2018-02-05 16:38 ZhangのBlog 阅读(1230) 评论(0) 推荐(0)

爬取股票信息

摘要: #目标:获取上交所和深交所所有股票的名称和交易信息 #输出:保存到文件中 #技术路线:requests-bs4-re #候选网站选取原则: # 股票信息静态存在与html界面中,非js代码生成,没有robots协议限制 #选取心态: # 不要纠结于某个网站,多找信息源进行尝试 #程序结构程序设计 #步骤1:从东方财富网获取股票列表 #步骤2... 阅读全文
posted @ 2018-02-05 16:37 ZhangのBlog 阅读(778) 评论(0) 推荐(0)

python中的正则表达式的使用

摘要: 符号 含义 举例说明. 表示任何单个字符 【】 字符串,对单个字符给出取值范围 [abc]表示a,b,c,[a-z]表示a到z单个字符(或的关系) [^] 非字符集,对单个字符给出排除范围 [^abc]表示非a或b或c的单个字符 * 星号之前的一个字符0次... 阅读全文
posted @ 2018-02-04 18:13 ZhangのBlog 阅读(306) 评论(0) 推荐(0)

摘要: 一、栈的应用 1、直接应用 符号匹配 中缀表达式转换为后缀表达式 计算后缀表达式 实现函数调用(包括递归) 求范围误差(极差) 网页浏览器中的back按钮和历史记录 文本编辑器中的撤销操作 HTML和XML中的tag匹配 2、间接应用 作为一个算法的辅助数据结构 其他数据结构的组件(例如模拟队列) 阅读全文
posted @ 2018-01-27 22:06 ZhangのBlog 阅读(129) 评论(0) 推荐(0)