自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 mysql 数据库清理缓存

清理mysql缓存

2022-11-17 22:13:13 3750 1

原创 Win10修改MySql 8.0的配置文件

修改mysql配置文件

2022-06-30 09:56:49 2464 1

原创 c++ 并发与多线程--学习笔记(第9节)

#include <iostream>#include <string>#include <mutex>#include <condition_variable>#include<list>#include<map>#include<future>#pragma warning(disable:4996)using namespace std;class A{public: int mythrea

2021-09-08 16:13:16 118

原创 c++ 并发与多线程--学习笔记(第8节)

视频教程:https://www.bilibili.com/video/BV1Yb411L7ak?p=10&spm_id_from=pageDriver上次课程的代码#include <iostream>#include <string>#include <mutex>#include <condition_variable>#include<list>#pragma warning(disable:4996)using

2021-09-07 16:39:45 89

原创 const 用于指针

学习笔记,代码来源于《21天学会c++》1.指针包含的地址是常量,不能修改,但可修改指针指向的数据:int daysInMonth = 30; int* const pDaysInMonth = &daysInMonth; *pDaysInMonth = 31; // OK! Data pointed to can be changed int daysInLunarMonth = 28; pDaysInMonth = &daysInLunarMonth; // Not OK!

2021-08-31 09:54:35 84

原创 c++ 单例设计模式

整个项目中,有某个或者某些特殊的类,只能创建一个属于该类的对象。单例类:只能生成一个对象。#include<iostream>using namespace std;class MyCas //这是一个单例类{private: MyCas() {}; //私有化了构造函数private: static MyCas* m_instance; //静态成员变量public: static MyCas* GetInstance() { if (m_instance =

2021-08-23 16:23:45 47

原创 Python 用 py7zr压缩文件

py7zr 是一个开源库,详细的说明请参阅以下网址:py7zr代码示范简单示范压缩:代码py文件的所在路径是:E:要压缩的文件路径:E:\data压缩后的7z文件路径是:E:import oimport py7zrimport time#获取py文件所在路径dir = os.path.dirname(os.path.realpath('__file__')) #系统时间now_date = time.strftime("%Y-%m-%d")#压缩档名称archive_nam

2021-08-11 14:41:00 3204 1

原创 SimNow CTP 环境备份

SimNow CTP 环境备份simnow周末时经常打不开,备份一下~**1.7*24环境(发布日期2021/05/28)(看穿式前置,使用监控中心生产秘钥)**交易前置:180.168.146.187:10130,行情前置:180.168.146.187:10131;【7x24】**2 与实盘时间一致BrokerID统一为:9999第一组:Trade Front:180.168.146.187:10201,Market Front:180.168.146.187:10211;【电信】

2021-07-19 09:12:51 1129

转载 mysql无法启动(转载)

https://www.jb51.net/article/26505.htm转载保存

2021-06-25 10:50:49 83

原创 【小白教程】python文件打包成exe可执行文件(使用 pipenvp 、pyinstaller)

一、安装 pyinstaller打开cmd窗口:pip install pyinstaller二、打包文件打开cmd窗口,把路径切换到文件所在路径(文件随便放在哪里都行)打开命令提示行,输入以下内容(最后的是文件名):pyinstaller -F myfile.py三、如果出现以下错误A RecursionError (maximum recursion depth exceeded) occurred.For working around please follow these ins

2021-01-22 12:21:06 498 1

原创 python 爬虫中文乱码

使用requestsimport requestsimport chardetfrom lxml import etreefrom bs4 import BeautifulSoupres = requests.get("要爬取的网页")res.encoding = chardet.detect(res.content)['encoding']html = etree.HTML(res.text)prefix = '网址的前缀'#根据网页源码中的路径找到需要的结果links = ht

2021-01-18 14:08:54 173 2

原创 9.2 二叉树

//二叉树的存储结构struct node { typename data; int layer; node* lchild; node* rchild;}; node* root = NULL;//建立新结点node* newNode(int v) { node* Node = new node; Node->data = v; Node->lchild = Node->rchild = NULL; return Node;} //二叉树结点的查找、修改

2020-05-13 08:26:40 147

原创 PAT单词

insensitive例句:Note that words are case insensitive.翻译:请注意,单词不区分大小写。lexicographically词典顺序

2020-05-05 16:47:29 161

原创 质因子分解---《算法笔记》5.5

开一个结构体factor存放质因子和其个数,对于 int 来说,23571113171923*29已经超过 int 范围,因此fac数组开到10就行。struct factor { int x, cnt; //x为质因子,cnt为其个数}fac[10]步骤1:枚举 1 ~ 根号n 范围内的所有质因子p,判断p是否是n的因子。if(n % prime[i] == 0) { fac[...

2020-04-27 14:44:11 172

原创 素数模板---C语言实现

一般的写法,避免溢出//推荐写法,避免溢出 #include <math.h>bool isPrime(int n) { if(n <= 1) return false; //特例,1不是素数 int sqrt = (int)sqrt(1.0*n); //浮点数取整 for(int i=2; i<= sqrt; i++) { //遍历2~根号n if(...

2020-04-25 21:32:51 190

原创 分数的加减乘除运算模板--C语言实现

今天又是被大神教会做人的一天,书上的代码是没有问题的,有问题的是我的智商/(ㄒoㄒ)/~~一般建议使用模板,虽然模板的代码很长很长,但是输出时比较不容易出错代码来自 胡凡著 《算法笔记》 5.3分数的四则运算//分数的乘除法过程中可能超过int的范围,使用long long储存 typedef long long ll;//分数的表示 struct Frac{ ll up, down...

2020-04-25 18:37:40 1664

原创 最大公约数和最小公倍数

求解最大公约数:方法一:int gcd(int a, int b) { if(b==0) return a; else return gcd(b, a%b);}方法二:int gcd(int a, int b) { return !b ? a : gcd(b, a%b);求解最小公倍数:在最大公约数 d 的基础上,最小公倍数 c = ab/d ;但 ab 在实际计算时...

2020-04-24 12:27:18 146

原创 C语言--5种基本排序方法

基本排序冒泡排序选择排序插入排序归并排序递归非递归sort替换merge快速排序冒泡排序int main() { int a[10] = {3,1,4,5,6}; for(int i = 1; i <= 4; i++) { //进行n-1趟 //第i趟时从 a[0] 到 a[n-i-1] 都与它们下一个数比较 for(int j = 0; j < 5-i; j++) ...

2020-04-21 10:50:48 1012

原创 C语言生成随机数据

C语言中生成随机数据,需添加 stdlib.h 和 time.h 这;两个头文件。在main函数开头加上“srand((unsigned)time(NULL));”,这个语句将生成随机的种子,srand是初始化随机的种子。下面的代码是生成10个随机数。#include <stdio.h>#include <stdlib.h>#include <ti...

2020-04-20 11:04:53 1358

原创 算法笔记3.5---进制转换

一、将 p 进制数 x 转换为 十进制数 yint y = 0, product = 1; //product循环中会不断乘 p , 得到 1、p 、p^2...while( x != 0 ) { y = y + (x % 10) * product; // x % 10 是为了每次获取x的个位数 x /= 10; // 去掉 x 的个位 product *= p;}二、将十...

2020-04-15 14:00:52 174

原创 木棒切割问题(二分)---算法笔记4.5.2二分法拓展

#include <cstdio>#include <algorithm>#include <iostream> using namespace std;const int maxn = 10010;int main() { int a[maxn]; int n,k; cin >> n; cin >> k; fo...

2020-04-15 10:55:26 389 3

原创 二分搜索BinarySearch(代码模板)

BinarySearch 代码模板解决“寻找有序序列第一个满足某条件的元素的位置”问题的固定模板1.二分区间为左闭右闭的[left,right],初值必须能够覆盖解的所有可能取值int solve(int A[], int left, int right, int x) { int mid; while(left < right) { mid = (left + right) ...

2020-04-14 15:06:00 233

原创 C语言入门--水仙花数--翁恺MOOC

计算水仙花数水仙数是指一个N位正整数(N<=3),它的每个位上的数字的N次幂之和等于它本身。三位的水仙花数共有4个:153,370,371,407;#include <stdio.h>int main(){ int n; //scanf("%d", &n); n=3; int first = 1; int i=1; while (i<n) {...

2020-01-25 20:40:21 1386 1

原创 C语言入门--九九乘法表--翁恺MOOC

输出九九乘法表好几天没有练习了,都生疏了。#include <stdio.h>int main(){ int i,j; int n = 9; i = 1; while ( i <= n) { j = 1; while ( j <= i) { printf("%d*%d=%d",j,i,j*i); if ( i*j <10) { p...

2020-01-25 17:17:04 281 1

原创 C语言入门---指针初探---翁恺MOOC

#include <stdio.h>void f (int *p);void g (int k);int main(void){ int i=6; printf("&i=%p\n", &i); f(&i); g(i); return 0;}void f(int *p){ printf(" p=%p\n", p); printf...

2020-01-16 19:31:24 154

原创 C语言入门---二分法搜索---翁恺MOOC

使用二分法搜索可以大大提高搜索效率,搜索的次数等于log2^n对于一个数组,将索引0处设为left, 索引-1处设为right, 每一次将中值a[mid]与k比较。若不相同,将left向右移动,直到 right < left ,输出匹配到的索引值。#include <stdio.h>int main(){ int a[] = {2,4,7,11,13,16,21,2...

2020-01-16 14:52:52 406 5

原创 C语言入门---构建素数表---翁恺MOOC

(一个非素数x,一定可以表示成两个数(除了0和x本身以外)的乘积,这两个数必然有一个小于等于x的平方根,故可以使用 sqrt函数去求素数和)

2020-01-16 13:06:36 1317

原创 C语言入门---用数组做散列计算---翁恺MOOC

输入数量不确定的【0,9】范围内的整数,统计每一种数字出现的次数,输入-1表示结束#include <stdio.h>int main(){ const int number = 10; //数组的大小 int x,i; int count[number]; //定义数组 for ( i=0; i<number; i++); { //for loop 初始...

2020-01-15 16:49:54 416

原创 C语言入门---初试数组---翁恺MOOC

计算数组的平均数,然后打印出高于平均数的那些数(这个程序的bug在于输入的数字可能超过100个)#include <stdio.h>int main(){ int x; double sum = 0; int cnt = 0; int number[100]; //定义数组 scanf("%d", &x); while (x!=-1) { numb...

2020-01-15 15:50:15 298 1

原创 C语言入门---求最大公约数---翁恺MOOC

用辗转相除法求最大公约数输入a,b两个数,计算a除以b的余数,让a=b,b=余数,直到b=0.假设a=12,b=18:a b t12 18 1218 12 612 6 06 0#include <stdio.h>int main(){ int a,b,t; scanf...

2020-01-15 10:45:45 276

原创 C语言入门---前n项求和---翁恺MOOC

f(n) = 1 + 1/2 + 1/3 + 1/4 +…+ 1/n#include <stdio.h>int main(){ int x; scanf("%d", &x); double sum=0.0; int i; for (i=1;i<=x;i++) { sum += 1.0/i; } printf("f(%d)=%f\n",x,sum)...

2020-01-15 10:33:05 734

原创 C语言入门---整数求逆---翁恺MOOC

#include <stdio.h>int main(){ int x; scanf("%d", &x); int digit; int ret = 0; while (x>0) { digit = x%10; ret = ret*10 + digit; x /=10; printf("x=%d,digit=%d,ret=%d\n",x...

2020-01-15 09:52:10 838 1

原创 C语言入门---猜数游戏---翁恺MOOC

先调用rand() 让计算机跑出一个随机的数,一般最多猜7次就能猜中。 因为用二分法来取数, 2^6=64 2^7=128 最坏情况下执行7次就超过100,所以7次就够_#include <stdio.h>#include <stdlib.h>#include <time.h>int main(){ srand(time(0)); int num...

2020-01-14 15:48:41 2276 2

原创 Python编程从入门到实践 课后习题7-8、7-9、7-10

7-8sandwich_orders =['chicken','beef','fish','egg','cheese']finished_sandwiches = []while sandwich_orders: sandwich = sandwich_orders.pop() print("I made your " + sandwich + " sandwich.") ...

2019-12-11 10:57:15 904

原创 Python编程从入门到实践 课后习题7-4、7-5、7-6

Python编程从入门到实践 课后习题7-4、7-5、7-6记录练习的答案7-4 披萨配料question = "你想加什么配料?"question += "\n (Enter 'quit' 结束循环)\n"topping = ""while topping != 'quit': topping = input(question) if topping ==...

2019-12-11 09:52:43 1714

空空如也

空空如也

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

TA关注的人

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