- 博客(16)
- 收藏
- 关注
原创 简单爬虫----爬取斗罗大陆3的100个章节
搞了一晚上终于搞好了这个爬虫。。。话说获得下一章的标签真不容易,用到了select选择器,然后获得a标签里面的href属性费了好大劲,测试了下爬取100章差不多花了半分钟代码: #coding=utf-8import sysreload(sys)sys.setdefaultencoding('utf-8')import urllib2from bs4 import Beau...
2017-10-30 22:34:21 1068 1
原创 简单的爬虫----爬取百度百科练习
一开始看完文件的读写后以为可以一气呵成得写完这个代码,中途发现了很多得问题,比如中文字符写入文件格外得麻烦,还有就是一开始用requests来发送请求不知道为什么会报错,后来改成了urllib2.urlopen就不报错了,中文字符的处理看完一篇博客以后恍然大悟:点击打开链接,要转码的略显麻烦,不过也学到了,还有就是正则表达式很容易出错。。。还是bs4大法好,然后学到了如果想要获得标签之间的内容就用.text,然后贴上代码
2017-10-29 21:50:21 483
原创 CodeForces 337D Book of Evil(双向dfs)
Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each of these paths connects some pair of
2017-10-29 19:44:14 377
原创 codeforces 315 B.Sereja and Array(线段树区间更新+单点更新+单点询问)
Sereja has got an array, consisting of n integers, a1, a2, ..., an. Sereja is an active boy, so he is now going to complete m operations. Each operation will have one of the three forms:Make vi-th array element equal to xi. In other words, perform the ass
2017-10-29 19:40:31 418
原创 简单的爬虫------百度贴吧爬图程序
最近学了一阵子的Python,会了基本语法之后就开始自学了一些爬虫,下面分享一下学习过程 首先要安装python,官网下就好了,然后下载pycharm这个ide集成开发环境,很好用的,设置一下路径就可以用它来编写python了,这些都是自行百度,然后写学爬虫,你还要下载一些插件模块,比如beautifulsoup4,当然下载这个之前你要先下载一个pip并安装好,是用来管理python的插件的,安装过程要用到cmd,安装好了还要设置一下环境,细节百度~我也是摸索了很久,还是不懂可以call我(其实也不是很
2017-10-29 08:40:14 689
原创 Codeforces Round #443 (Div. 2) B. Table Tennis(模拟)
n people are standing in a line to play table tennis. At first, the first two players in the line play a game. Then the loser goes to the end of the line, and the winner plays with the next person from the line, and so on. They play until someone wins k ga
2017-10-27 08:51:15 588
原创 Codeforces Round #443 (Div. 2) A. Borya's Diagnosis(水水的模拟)
It seems that Borya is seriously sick. He is going visit n doctors to find out the exact diagnosis. Each of the doctors needs the information about all previous visits, so Borya has to visit them in the prescribed order (i.e. Borya should first visit docto
2017-10-27 08:49:05 648
原创 CodeForces 292D Connected Components(变种并查集+预处理)
We already know of the large corporation where Polycarpus works as a system administrator. The computer network there consists of n computers and m cables that connect some pairs of computers. In other words, the computer network can be represented as some
2017-10-22 20:36:19 469
原创 Codeforces 276D. Little Girl and Maximum XOR(模拟)
A little girl loves problems on bitwise operations very much. Here's one of them.You are given two integers l and r. Let's consider the values of for all pairs of integers a and b (l ≤ a ≤ b ≤ r). Your task is to find the maximum value among all consider
2017-10-22 20:31:50 788
原创 Codeforces 276C Little Girl and Maximum Sum(线段树的区间更新)
The little girl loves the problems on array queries very much.One day she came across a rather well-known problem: you've got an array of nelements (the elements of the array are indexed starting from 1); also, there are qqueries, each one is defined by a
2017-10-22 20:25:15 407
原创 装ubuntu经验分享---电脑中win10和linux系统共存的做法
因为加入了ACM应用组,学长要我们装linux来学一些东西。。。然后就搞了一天的装系统今天终于搞好,这里分享经验。首先去百度ubuntu去官网下载17.04(当前最新版本)的ubuntu,当时问了下学长不推荐下优麒麟,然后要去百度下载UltraISO来打开你下载好的iso文件,然后你要准备一个至少2G的U盘,记住U盘里的文件要备份会消失,用UltraISO打开下好的ubuntu文件,然后点开界面里的启动项,点写入硬盘映像,然后点一堆确定等一会u盘里就装好了ubuntu的安装文件,然后你还需要为ubuntu
2017-10-17 19:36:34 4729
原创 Codeforces Round #149 (Div. 2) E. XOR on Segment(21棵线段树处理每一位+区间异或)
You've got an array a, consisting of n integers a1, a2, ..., an. You are allowed to perform two operations on this array:Calculate the sum of current array elements on the segment [l, r], that is, count value al + al + 1 + ... + ar.Apply the xor operatio
2017-10-15 20:34:50 386
原创 CodeForces 242C King's Path(bfs+stl)
The black king is standing on a chess field consisting of 109 rows and 109 columns. We will consider the rows of the field numbered with integers from 1 to 109 from top to bottom. The columns are similarly numbered with integers from 1 to 109 from left to
2017-10-15 20:29:30 572
原创 Codeforces Round #438 (Div. 1 + Div. 2 combined) B. Race Against Time(模拟)
Have you ever tried to explain to the coordinator, why it is eight hours to the contest and not a single problem has been prepared yet? Misha had. And this time he has a really strong excuse: he faced a space-time paradox! Space and time replaced each othe
2017-10-05 17:09:33 469
原创 Codeforces Round #438 (Div. 1 + Div. 2 combined) A. Bark to Unlock(模拟)
As technologies develop, manufacturers are making the process of unlocking a phone as user-friendly as possible. To unlock its new phone, Arkady's pet dog Mu-mu has to bark the password once. The phone represents a password as a string of two lowercase Eng
2017-10-05 16:45:01 633
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人