自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 PAT(甲级)2019年冬季考试 7-1 Good in C (20分)

```scanf```无法读取空格,需要用```getline```读取空格 ```char```数组得开得大一点,这种字符串的题就应该用```string```做,不可能判断超时 最后的错误:```测试点4 运行时错误```(PAT给出的可能情况是:数组访问越界,) 数组越界,把每个数组开到```10000```即可(```测试点3:3分```)#include <bits/stdc++.h>using namespace std;char line[30][10][...

2020-09-03 11:23:46 223 1

原创 L2-031 深入虎穴 (25分)

测试点1(1分) 深度为0时的特判,需要将起始深度设为-1#include <bits/stdc++.h>using namespace std;vector<int> e[100010];int book[100010];int n;int maxdepth,index1;void dfs(int u,int depth){ if(depth>maxdepth){ maxdepth=depth; index1=u

2020-08-29 07:07:03 491

原创 1115 Counting Nodes in a BST (30 分)

https://pintia.cn/problem-sets/994805342720868352/problems/994805355987451904AC代码:一开始考虑错n1,n2的值,结果只得了2分,而后看大佬代码,发现问题。我用的是层次遍历,先给每层结点赋上层次值,然后再先序遍历,记录n1与n2,然后给出答案,#include <iostream>#inc...

2019-04-10 19:02:01 236

转载 1110 Complete Binary Tree (25 分)

https://pintia.cn/problem-sets/994805342720868352/problems/994805359372255232#include <iostream>#include <cstdio>#include <queue>#include <string>using namespace std;i...

2019-04-10 15:01:30 173

原创 1086 Tree Traversals Again (25 分)

AC代码:#include <iostream>#include <stack>#include <cstdio>#include <string>using namespace std;const int maxn = 35;int n;int post[maxn], in[maxn], pre[maxn];struct n...

2019-04-09 16:59:28 177

原创 1007 Maximum Subsequence Sum (25 分)

18分代码:#include <iostream>#include <vector>#include <algorithm>using namespace std;const int maxn = 10010;int A[maxn], dp[maxn];//1,2,3,-7,8情况不存在,因为1+2+3+(-7)<0,尽管-7+8&gt...

2019-04-07 19:14:29 131

原创 1029 Median (25 分)

22分代码(内存超限):#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn = 400010;int a[maxn];int main() { int n; cin >> n; for (int...

2019-04-07 12:16:27 271

原创 1041 Be Unique (20 分)

#include <iostream>#include <cstdio>using namespace std;const int maxn = 100010;const int maxv = 10010;int a[maxv];int b[maxn];int main() { int n; cin >> n; for (int i = ...

2019-04-07 07:40:01 354

原创 1083 List Grades (25 分)

#include <iostream>#include <cstdio>#include <string>#include <algorithm>using namespace std;const int maxn = 10010;struct student { string name,id; int scr;}stu[ma...

2019-04-07 00:49:34 192

原创 1075 PAT Judge (25 分)测试点4修正

#include <iostream>#include <cstdio>#include <string>#include <algorithm>#include <vector>using namespace std;const int maxn = 10010;const int maxpro = 6;//结构体...

2019-04-07 00:41:29 1179

原创 1055 The World's Richest (25 分)

超时代码:#include <iostream>#include <cstdio>#include <string>#include <algorithm>#include <vector>using namespace std;const int maxn = 100100;struct person { str...

2019-04-06 23:46:41 174

原创 1025 PAT Ranking (25 分)

#include <iostream>#include <cstdio>#include <string>#include <algorithm>using namespace std;const int maxn = 30100;struct person { string num; int scr; int finalran...

2019-04-06 22:56:19 113

原创 1036 Boys vs Girls (25 分)

水题,以后不发自己怎么做的了。。。。。。。。。。#include <iostream>#include <string>#include <algorithm>#include <cmath>using namespace std;const int maxn = 1010;struct person { string nam...

2019-04-06 18:16:56 167

转载 Python爬取 增加用户代理和ip代理

转:https://www.cnblogs.com/zhangdaxiang/p/7681846.html解决403禁止访问:https://blog.csdn.net/jsqfengbao/article/details/44594985# -*-coding:utf-8-*-import urllib2import randomurl = "http://blog.csdn...

2019-04-01 20:50:32 236

转载 Python爬取 分析Ajax爬取B站python视频---详细资料

Flag:一天一爬虫。这篇是转的:https://blog.csdn.net/sixkery/article/details/81946308亲测有效,对转载网站的分析做进一步分析补充:分析页面:如何获取api?这次我直接打开开发者工具,切换到Network下查找api,要点击Python旁边的搜索按钮,不然Network一片空白,点击搜索之后:会在其中...

2019-04-01 20:39:17 518

原创 1012 The Best Rank (25 分)

题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805502658068480注意点:map的value值排序,可以通过vector排序解决参考博客:https://blog.csdn.net/weixin_41168353/article/details/81203181AC代码:#inclu...

2019-03-30 18:36:21 251

转载 1010 Radix (25 分)

题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805507225665536由于不知道radix如何取值,所以上网搜了一下,参考博客:https://blog.csdn.net/CV_Jason/article/details/80993283注意点:二分查找的边界情况(15'->25')...

2019-03-30 09:50:45 183

原创 1009 Product of Polynomials (25 分)

题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805509540921344AC代码:关于测试点1,3#include <iostream>#include <vector>#include <algorithm>#include <cmath>...

2019-03-29 19:06:02 336

原创 1008 Elevator (20 分)

题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805511923286016#include <iostream>#include <vector>#include <algorithm>using namespace std;int main() { ...

2019-03-29 18:41:02 105

原创 1006 Sign In and Sign Out (25 分)

题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805516654460928AC代码:#include <iostream>#include <string>using namespace std;int main(){ int n; cin >&gt...

2019-03-29 16:53:30 146

原创 酷我歌词爬取--《不将就》

歌是真的好听利用CSS路径爬取缺点:未爬取全部歌词。from selenium import webdriverimport timeurl='http://bd.kuwo.cn/yinyue/6863662?from=baidu'def start_chrome(): driver=webdriver.Chrome() driver.start_clien...

2019-03-25 06:09:13 816

原创 01网络与爬虫-2练习. 找点Python小项目

要求:从github上选出符合这些条件的项目:1,最近一周内发布的2,语言是python3,size小于200k的代码把这些项目的链接print出来import requestsrepo_api = 'https://api.github.com/search/repositories?q='ecosys_api = 'https://api.github.c...

2019-03-25 05:58:22 152

原创 01网络与爬虫-4练习.微博话题数据提醒

当微博上话题 #奥斯卡# 的讨论数破370万时,print 出来我抓取的是微博热门话题 #郑爽演技#讨论数超过6万,便发出对郑爽由衷的赞美!!!from selenium import webdriverimport timeurl="https://s.weibo.com/weibo/%2523%25E9%2583%2591%25E7%2588%25BD%25E6%25BC...

2019-03-25 05:25:28 195

原创 01网络与爬虫-1. 如何监测 GitHub 项目更新并自动打开网页

感觉麻瓜编程的入门,由浅入深,真不错,不愧是付费精品。初始代码:1. 练习:Kenneth 今天 Star 了哪些库首先https://github.com/kennethreitz 的API就不会找,一开始写成了https://api.github.com/repos/kennethreitz ,这明显是仓库的意思,官方文档:https://developer.github.co...

2019-03-22 21:42:19 445

原创 Python爬取 表情包爬取

Xpath Helper安装:http://chromecj.com/utilities/2019-01/1791.html软件安装地址:https://blog.csdn.net/yhnobody/article/details/81030436Q1,如何得到请求头headers:Q2,如何在PyCharm安装库:先讲解def Download_imag...

2019-03-22 00:45:29 2634

原创 Day1 Selenuim+urllib+正则表达式

知识点:1,写爬虫不是一蹴而就的,要会单点测试2,正则表达式不一定能够一级抓取,要学会二级抓取3,urllib 只能抓一些普通的网站作业:抓取51job的北上广深的Python岗位薪资情况# encoding:utf-8import seleniumfrom selenium import webdriver #模拟浏览器import redef getnumbe...

2019-03-20 16:51:18 127

转载 Python爬取 美剧《纸牌屋》字幕(可可英语)---BeautifulSoup版

爬虫还是不会写,所以借鉴一个,仔细分析分析:https://blog.csdn.net/only_anan/article/details/800823161,导入爬取要用到的库,主要是是BeautifulSoup库很有用import reimport urllib.requestfrom bs4 import BeautifulSoup2,利用BeautifulSoup库获取网...

2019-03-19 00:02:04 837

转载 《Python编程快速上手》---项目记录(第13章)

13.2 项目:从多个 PDF 中合并选择的页面import PyPDF2, os# Get all the PDF filenames.pdfFiles = []'''第 1 步:找到所有 PDF 文件'''for filename in os.listdir('.'):#os.listdir('.')调用将返回当前工作目录中所有文件的列表。 if filename.ends...

2019-03-18 17:57:39 302

原创 《Python编程快速上手》---项目记录(第12章)

12.4 项目:从电子表格中读取数据import openpyxl, pprintprint('Opening workbook...')wb = openpyxl.load_workbook('censuspopdata.xlsx')sheet = wb.get_sheet_by_name('Population by Census Tract')countyData = {}...

2019-03-17 19:01:11 1017

原创 《Python编程快速上手》---项目记录(第14章)

14.1.4 delimiter 和 lineterminator 关键字参数最好不要用delimiter=‘\t’,来进行隔纵行操作,因为没用,import csvoutputFile = open('output.csv', 'w',newline='')outputWriter = csv.writer(outputFile,delimiter='\t',linetermina...

2019-03-16 17:45:03 562

原创 Python爬取 豆瓣读书标签:编程

要爬取的网站:https://book.douban.com/tag/%E7%BC%96%E7%A8%8B?start=%7B%E5%81%8F%E7%A7%BB%E9%87%8F%7D&amp;type=T爬取网站示意图:爬取结果:简单版:复杂版:代码:简单版:import numpy as npimport csvimport timedef...

2019-03-16 01:07:03 615

转载 第三章 《Python3 网络爬虫开发实战》

3.1.1查看cookie(Chrome版):3.4-爬取猫眼电影排行代码,崔老师的博客有,说说我遇到的问题,和记录1,关于这个正则表达式匹配问题:pattern = re.compile( '&lt;dd&gt;.*?board-index.*?&gt;(.*?)&lt;/i&gt;.*?data-src="(.*?)".*?name.*?a.*?&gt...

2019-03-16 00:39:15 302

原创 《Python编程:从入门到实践》---项目2

第15章 生成数据15-1 立方:import matplotlib.pyplot as plt'''x_values = [1, 2, 3, 4, 5] y_values = [x**3 for x in x_values]plt.scatter(x_values,y_values,s=100)#plt.plot(x_values,y_values, linewidth...

2019-03-13 19:30:39 1345 1

原创 《Python编程快速上手》---项目记录(第9章)

遍历目录树:import shutil,os#os.chdir('D:\\')#遍历目录树def traverse_directoryTree(path): for folderName, subfolders, filenames in os.walk(path): print('The current folder is ' + folderName) for subf...

2019-03-13 15:55:13 200

转载 《Python编程快速上手》---项目记录(1-7章)

第5章 列表5.6 实践项目5.6.2 列表到字典的函数,针对好玩游戏物品清单stuff = {'rope': 1, 'torch': 6, 'gold coin': 42, 'dagger': 1, 'arrow': 12}def displayInventory(inventory): print("Inventory:") item_total = 0 for k, v...

2019-03-12 14:06:27 842

原创 C++知识点总结

基本动机:为明年考研做准备1,new/delete 和malloc/free 的区别:a,身份: malloc/free为C的标准库函数,void* malloc(size_t size);//参数 代表字节个数void free(void* pointer);//参数 代表内存地址new/delete为C++的操作运算符,//其调用分别是赋值运算符重载operat...

2019-03-10 14:11:17 190

原创 《Python编程:从入门到实践》 第二部分 项目

1,关于pygame的安装:先安装anaconda对应版本,配置环境变量,检查pip,python,及其版本可以通过命令行pip install pygame直接安装pygame!!!

2019-03-07 17:48:33 550

原创 PAT乙级总结

过程:寒假回去刷了几遍乙级题库,《算法笔记》深度优先搜索之后的就没认真看总结:(1),暧昧上头的那几秒,像极了爱情(2),边界条件以后必看,不然影响我得100分(那2分是第一题丢的)目标:2019.9的甲级100分,...

2019-03-05 14:56:10 495

原创 1001 A+B Format (20 分)

题目链接:https://pintia.cn/problem-sets/994805342720868352/problems/994805528788582400我的7分代码:#include &lt;iostream&gt;#include &lt;cstdio&gt;#include &lt;string&gt;#include &lt;algorithm&gt;#in...

2019-03-02 21:05:13 110

转载 第123场周赛

方法一:逐位相加思路让我们逐位将数字加在一起。举一个例子,如果要计算 123 与 912 的和。我们顺次计算 3+2、2+1、1+9。任何时候,当加法的结果大于等于 10 ,我们要将进位的 1 加入下一位的计算中去,所以最终结果等于 1035。算法我们可以对以上的想法做一个小变化,让它实现起来更容易 —— 我们将整个加数加入数组表示的数的最低位。继续之前的例子 123+912,我们把它表示成 [1, 2, 3+912]。然后,我们计算 3+912 = 915。5 留在当前这一位,将 910/10=

2019-02-13 23:54:14 139

空空如也

空空如也

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

TA关注的人

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