自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(48)
  • 问答 (2)
  • 收藏
  • 关注

原创 4多线程,多进程,线程池

这里写目录标题多线程多进程线程池多线程from threading import Thread#method1:def func(): for i in range(10000): print("func:",i)if __name__ == '__main__': t = Thread(target=func) t.start() for i in range(10000): print("main

2021-11-29 20:53:05 217

原创 5 selenium,下拉列表(select),验证码

seleniumselenium的简单操作爬取[拉钩招聘](https://lagou.com)的简单信息1爬取[拉钩招聘](https://lagou.com)的简单信息2无头浏览器及下拉列表获取[艺恩](https://www.endata.com.cn/BoxOffice/BO/Year/index.html)历年排行榜通过工具[超级鹰](https://www.chaojiying.com/)来进行验证码的处理chaojiying.py超级鹰干掉超级鹰网站检测到使用自动化工具打开解决方法登录[中国铁

2021-11-28 21:22:21 565

原创 3 cookie、防盗链

这里写目录标题cookiecookie##获取17k小说网书架中的内容登录 -> 获得cookie带着cookie请求书架的url -> 获得书架上的内容使用session进行请求 -> session认为这是一连串的操作,在此过程中cookie不会丢失import requestssession = requests.session()data ={ "loginName":"13219308276", "password":"xcsrs0711"}

2021-11-23 21:00:43 2055

原创 2从html中提取相关数据

从html中提取相关数据正则表达式基础re模块的使用findallfinditersearchmatchcompile获取[豆瓣TOP250](https://movie.douban.com/top250?start=0&filter=)指定内容获取[电影天堂](https://dytt89.com/)指定内容Bs4正则表达式基础re模块的使用findallimport re#匹配字符串中的内容,并以列表的形式返回,若不加符号“+”,则在列表中返回的是单个的字符,否则列表中返回的是字

2021-11-20 14:16:33 1282

原创 1爬虫基础预备

爬虫(web、http、request)请求任一网址请求任一网址from urllib.request import urlopenurl = "http://www.baidu.com" #应为http而不是httpsresp = urlopen(url)with open("jfdhj.html",mode="w",encoding="utf-8") as f: f.write(resp.read().decode("utf-8")) #decode按照指定的格式解码字符串

2021-11-06 10:28:51 65

原创 12进程、线程、协程

进程与线程多进程ProcessPoolsubprocessqueue多进程Processfrom multiprocessing import Processfrom multiprocessing import Poolimport os,time,randomdef run_proc(name): print('Run child process %s (%s)...' % (name, os.getpid()))if __name__=='__main__': pr

2021-09-20 15:20:29 87

原创 opengl正方体

通过鼠标控制正方体的旋转方向,通过键盘控制正方体的移动#include <GL/glut.h>#include<stdlib.h>GLint b;GLint aa[3];GLint u;GLint xfirst;GLint yfirst;GLint xsecond;GLint ysecond;GLint x1;GLint y1;bool mousedown=0;void display(){ glClear(GL_COLOR_BUFFER_BIT|GL_

2021-05-22 18:00:58 492

原创 opengl旋转的正方体

旋转的正方体通过鼠标控制正方体绕x,y,z轴旋转通过鼠标控制绕正方体上某一点运动通过鼠标控制正方体绕x,y,z轴旋转#include <GL/glut.h>GLint b;float theta[3];void display(){ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); /

2021-05-22 17:59:13 432

原创 opengl四分之一茶壶

#include <gl/glut.h>void init(void){ GLfloat light_position[] = {1.0,1.0,1.0,0.0}; glClearColor(1.0,0.0,0.0,0.0);// glShadeModel(GL_SMOOTH);// glLightfv(GL_LIGHT0,GL_POSITION,light_position);// glEnable(GL_LIGHTING);// glEnable(GL_LIGHT0);//

2021-05-22 17:52:58 230

原创 opengl三小球旋转

#include<GL/glut.h>GLint b;void display(){ glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); gluLookAt(1,0.5,0,0,0,0,0,1,0); glColor3f(1,0,0); glRotatef(b,0,1,0)

2021-05-22 17:52:07 221

原创 openGL 可以动的矩形

#include <windows.h>#include <gl/glut.h>#include<gl/gl.h>#include<gl/glu.h>// 参数指定正方形的位置和大小GLfloat x1 = 100.0f;GLfloat y1 = 150.0f;GLsizei rsize = 50;//正方形运动变化的步长GLfloat xstep = 1.0f;GLfloat ystep = 1.0f;// 窗口的大小GLflo

2021-05-22 17:49:39 100

原创 OpenGL彩色茶壶

#include <gl/glut.h>void init(void){ glClearColor(0.0,0.0,1.0,0.0); glShadeModel(GL_SMOOTH); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); GLfloat light0_ambient[]={1,0.0,0.0,0.0}; GLfloat light0_diffuse[]={1,0.0,0.0,0.0}; GLfloat light0_spe.

2021-05-22 17:47:29 742

原创 11 文件

文件文件的打开与关闭读数据with的使用文件的打开与关闭语法格式:open(’ 路径 ', ’ 打开模式 ') 此命令为创建或打开指定的文件存在即打开,不存在即创建以下代码可能会因为编码格式的不同而出现乱码#以默认的编码gbk为中文编码,在使用时最好指定一个编码类型#打开文件b=open('./test.text','w',encoding='utf-8')#w模式每执行一次都会创建一个新文件而覆盖掉之前的文件#读/写操作b.write('圣诞节公布的健康的高考')b.write('

2021-05-22 15:08:15 512

原创 hdu1425 sort

代码一:#include<iostream>#include<algorithm>#include<cstdio>using namespace std;int a[1000000];int cmp(int a, int b){ return a > b;}int main(){ int n,m,i; while(~scanf("%d%d",&n,&m)) { for(i=0; i<n; i++) sca.

2021-05-06 09:45:29 64

原创 hdu1418 抱歉

欧拉公式:点数 + 面数 - 线数 = 2#include<iostream>using namespace std;int main(){ unsigned int n,m; while(cin>>n>>m&&(n||m)) cout<<n+m-2<<endl;}

2021-05-05 20:09:22 71

原创 hdu 1215 七夕节

此代码会超时#include<iostream>using namespace std;int main(){ int t, n, i; int sum = 0; cin >> t; while(t--) { int sum = 0; cin >> n; for(i=1; i<=n/2; i++) { if(n % i ==0) sum+=i; } cout << sum << ..

2021-04-30 17:16:33 75 1

原创 小球做平抛运动下落

void paintBall(int x,int y,int r,CDC *pDC){ int R=0,G=0,B=0; double w,d; w=r;d=w/255; for(; w>=0; w-=d) { CPen p; p.CreatePen(1,1,RGB(R,G,B)); pDC->SelectObject(&p); pDC->Ellipse(x-w,y-w,x+w,y+w); R+=10;G+=10;B+=10;

2021-04-25 15:13:58 158

原创 MFC 画出钟的外形

void CMy2View::OnDraw(CDC* pDC){ CMy2Doc* pDoc = GetDocument(); ASSERT_VALID(pDoc); char s[12] = {6,5,4,3,2,1,12,11,10,9,8,7}; int n,x, y; double i; n=0; CString c; for(i=0; i<576; i+=52.3) { c.Format("%d",s[n]); x = int(200 + 200 * sin(i/

2021-04-25 15:11:02 89

原创 hdu1071 The area

#include<stdio.h>#include<math.h>struct point{ double x,y;};//注意结构体的使用int main(){ double a,m,c,k,b,area,f; struct point p[4]; int i,t; scanf("%d",&t); while(t--) { for(i=1;i<=3;i++) sc..

2021-04-24 14:28:33 87

原创 hdu1021 Fibonacci Again

通过找规律可以得到最终的结果#include<stdio.h>#include<iostream>using namespace std;int main(){ //7 11 18 29 47 76 123 199 322 521 843 1346 2207 3353 5760 //由此可以看出当 n % 4 == 2 时所代表的数可以被三整除 int n; while(cin >> n) { if(n % 4 == 2) cout &.

2021-04-23 20:27:06 63

原创 hdu 2001 计算两点间的距离

#include<stdio.h>#include<string>#include<iostream>#include<algorithm>#include<math.h>using namespace std;int main(){ double a, b, c, d; double m, n, f; while(cin >> a >> b >> c >>d) { m =.

2021-04-23 19:30:24 40

原创 hdu 2000 ASCII码排序

此题在c++中较为简单,一个sort函数就可以搞定,但是还是要注意下输出的格式#include<stdio.h>#include<string>#include<iostream>#include<algorithm>using namespace std;int main(){ //char s[3]; string s; int i; while(cin >> s) { sort(s.begin(), s.end(.

2021-04-20 19:42:05 46

原创 通过四个控制点绘制三次贝赛尔曲线

CPoint points[4];int count=0;void CMyView::OnDraw(CDC* pDC){ CMyDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); int q,w,xx1,yy1, xx2,yy2; for(float t=0; t<1; t+=0.001) { xx1 = (1-t) * (1-t) * points[0].x + 2 * t * (1-t) * points[1].x + t * t *.

2021-04-19 10:43:16 1333 1

原创 小明作业

备注:iawaswapwauawhawdwafwanbiopwanivgbikvblvbwawawawvolyuvgbololvolgbyolgyowagbolgawgboplwawaolgyolwaogblwaygbowawagwabwayawopwawagyowabwaowapjwapcfrtuywawacvujwawawaufttyfuftywawawatifgugbgbyguwawawawayugbigwwwytigwygwgbwyoawawgoghwaogwborgrewabouyhwaby..

2021-04-14 21:02:30 84

原创 填充正六边形

此示例为填充正六边形struct Edge //用来储存边的结构体{ int yUpper;; float xIntersect, dxPerScan; struct Edge * next;//指向下一条边的指针}tEdge;//结构体变量void insertEdge(Edge *list, Edge *edge){ Edge *p, *q = list;//插入边的函数 p = q ->next; while(p != NULL) { if (edge ->xI

2021-04-14 11:02:18 113

原创 1005 Number Sequence

利用鸽巢原理可知共有49种可能即(f[i-1],f[i-2]分别都可能为0,1,2,3,4,5,6)且f[n]为一循环的数字,找到规律即可,此代码在hdu上无法通过,错误未知。#include <stdio.h>#include <iostream>#include <algorithm>using namespace std;int f[100];int main(){ int a, b, i, n; int pos = 0; while(1).

2021-04-08 17:06:49 58

原创 9面向对象基础(下)

面向对象基础(下)私有化属性私有化属性通俗来说就是给属性加一把锁,可以通给给定的路径对其进行访问但是不能进行修改。语法:以两个下划线开头,不能在类的外部被使用或直接访问子类不可继承父类的私有化属性class Person: __hoby = "游泳" def __init__(self): # self.name ="挂电话" self.__name = "挂电话"#进行私有化,不可在外部直接访问 self.age = 90

2021-03-29 20:54:54 91

原创 AcWing 91. 最短Hamilton路径

#include <iostream>#include <cstring>#include <algorithm>using namespace std;int f[1<<20][20], weigh[20][20];int i, k, j, n;int main(){ memset(f, 0x3f, sizeof(f));//将此二维数组全部赋值为正无穷 cin >> n; for (i=0; i&l.

2021-03-24 19:54:20 36

原创 Acwing 90. 64位整数乘法 快速幂取模的变形

#include <iostream>using namespace std;typedef unsigned long long ull;ull q(ull a, ull b, ull p){ ull res = 0 ; while(b) { if (b & 1) res = (res + a) %p; a = a * 2 % p; b >>= 1; } return res;}int main(){ ull a, b, p.

2021-03-17 21:26:33 75

原创 Acwing 89 a^b 位运算 快速幂

快速模取幂#include <iostream>using namespace std;int main(){ int a, b, p; cin >> a >> b >> p; int res = 1 % p; while (b) { if (b & 1) res = (long long)res * a % p; a = (long long)a .

2021-03-14 17:34:24 68

原创 8面向对象基础(中)

面向对象基础析构方法析构方法class Animal: def __init__(self,name): self.name=name print('这是构造初始化方法') pass def __del__(self): #主要应用就是来操作对象的释放,一旦释放完毕,对象不能再使用 print('当在某个作用域下面,没有被使用的情况下,解释器会自动调用此函数来释放内存空间') print('这

2021-03-13 11:26:30 119

原创 7面向对象基础(上)

这里写目录标题面向对象的介绍类和对象面向对象的介绍面向对象编程:oop[object oriented programing]是一种python的编程思路面向过程·:按照解决问题的步骤去写代码【根据业务逻辑去写代码】类和对象类:是具有一组相同或相似特征【属性】和行为【方法】的一系列对象的集合现实世界 计算机世界行为------------------> 方法特征------------------> 属性对象:对象是实实在在的一个东西,类的的

2021-02-24 15:52:14 84

原创 6内置函数

内置函数内置函数数学运算内置函数python内置函数详细见链接.数学运算abs()round()pow()

2021-02-09 16:15:06 304

原创 5 函数2

函数2函数的基本类型全局变量与局部变量局部变量全局变量修改全局变量引用不可变型可变类型匿名函数递归函数阶乘模拟实现树形结构的遍历函数的基本类型1:无参数,无返回值,一般用于提示信息打印def m(): print("-" * 20)2:无参数,有返回值,多用在数据采集中,比如获取系统信息def mycpu():#获取cpu信息 return info3:有参数,无返回值,多用在设置某些不需要返回值的参数设置def s(a): pass4:有参数,有返回值一般是

2021-02-04 16:51:03 165

原创 AcWing104.货仓选址

AcWing104.货仓选址题目代码解释说明题目代码#include <iostream>#include <algorithm>#include <math.h>using namespace std;int main(){ int N=100010;//N为自己设定的数组的大小,a[N]为设立的输入数组 int n,a[N],i,c,s;//注意此处的a[N],不能为a[n],我就犯了这种低级错误,找了好久才发现,哈哈哈哈 s

2021-02-01 23:30:40 171

原创 4函数1

函数函数定义参数必选参数默认参数可选参数(不定长参数)关键字可选参数返回值返回列表返回元组返回字典函数的嵌套练习题函数定义def 函数名():函数体[]函数调用:。。。。。。。以上内容与其他计算机语言差不多def a(): print("vjbebg") print("vjbebg") print("vjbebg") print("vjbebg") print("vjbebg") print("vjbebg")passa()参数必选参数

2021-01-31 11:33:32 71

原创 3数据类型

列表,元组,字典列表增加append追加insert插入extend批量添加(赋值)修改del删除元组列表#li=[]空列表li=[1,2,3,'发横']print(len(li))#len函数可以获取列表对象中的数据个数a=['veige',12,12.24,False]print(a)#输出完整的列表print(a[0:2])print(a[::-1])print(a[0:2]*2)增加append追加li=[1,2,3,'发横']print('追加之前:',li)li.a

2021-01-31 10:55:24 249

原创 2循环,条件语句

if…elif…else循环单语句(if)a=90if a<80: print("bveg") pass#空语句print("njfb")双语句a=78if a>75: print("jg") passelse: print("bvhf")a=int(input("成绩:"))if a>90: print("A") passelif a>80: print("B") passelif a

2021-01-30 21:15:56 130

原创 1注释与输出

注释#为单行注释三个单引号或多引号为多行注释变量就是存储的数据,是临时存储数据的场所type 函数可以用来查看数据的类型a=10a="heguriggr"b="部分个人"print(a)print(b)print(type(a))print(type(b))元组类型b=()列表类型b=[]字典类型b={}//相除取整a,b,c=7,3,2print(a+b-c)a+=2print(a)比较运算符的优先级 ()>not>and>or算数运算

2021-01-29 22:48:44 58

原创 hdu 2629 Identity Card

代码如下(正确代码)#include <iostream>#include <string>using namespace std;int main(){ int n, t; string a, area; cin >> n; while(n--) { cin >> a; t = (a[0]-'0')*10+a[1]-'0'; switch(t) { case 11: area = "Beijing";break;

2021-01-29 22:35:17 1701

空空如也

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

TA关注的人

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