2023年6月4日

欧里几德算法(辗转相除法)

摘要: /*求两个正整数 a 和 b 的 最大公约数 d则有 gcd(a,b) = gcd(b,a%b)证明: 设a%b = a - k*b 其中k = a/b(向下取整) 若d是(a,b)的公约数 则知 d|a 且 d|b 则易知 d|a-k*b 故d也是(b,a%b) 的公约数 若d是(b,a%b)的公 阅读全文

posted @ 2023-06-04 21:23 不是小朋友L 阅读(21) 评论(0) 推荐(0)

2023年5月31日

筛法--朴素筛法和埃式筛法和线性筛法

摘要: 朴素筛法: #include <iostream> #include <algorithm> using namespace std; const int N=1000010; int primes[N],cnt; bool st[N]; void get_primes(int n){ for(in 阅读全文

posted @ 2023-05-31 22:20 不是小朋友L 阅读(113) 评论(0) 推荐(0)

2023年5月28日

分解质因数--试除法

摘要: #include <iostream>#include <cstring> #include <algorithm> using namespace std; void divide(int n){ for(int i=2;i<=n;i++) //这个地方是枚举到n { if(n%i==0) { i 阅读全文

posted @ 2023-05-28 14:36 不是小朋友L 阅读(77) 评论(0) 推荐(0)

2023年5月26日

质数的判定--试除法

摘要: #include <iostream> #include <cstring> #include <algorithm> bool is_prime(int n){ if(n<2)return false; for(int i=2;i<=n/i;i++) if(n%i==0)return false; 阅读全文

posted @ 2023-05-26 00:24 不是小朋友L 阅读(46) 评论(0) 推荐(0)

2023年5月6日

快速幂

摘要: 第一次写的代码:#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=res*1ll*a%p; a=a*a*1ll%p; //这 阅读全文

posted @ 2023-05-06 00:06 不是小朋友L 阅读(31) 评论(0) 推荐(0)

2023年4月20日

Mysql8.0为什么取消了缓存查询的功能

摘要: 首先我们介绍一下MySQL的缓存机制 【MySQL缓存机制】简单的说就是缓存sql文本及查询结果,如果运行完全相同的SQL,服务器直接从缓存中取到结果,而不需要再去解析和执行SQL。 但如果表中任何数据或是结构发生改变,包括INSERT、UPDATE、DELETE、TRUNCATE、ALTER TA 阅读全文

posted @ 2023-04-20 17:03 不是小朋友L 阅读(538) 评论(0) 推荐(0)

基本查询

摘要: 查询所有列 ( 关键字 *) select * from 表名; 查询指定列 select 列1,列2,列n from 表名; select `id`,`name`,`age`,`gender` from `student`; select `id`,`name`,`age` from `stude 阅读全文

posted @ 2023-04-20 15:09 不是小朋友L 阅读(36) 评论(0) 推荐(0)

增删改查

摘要: 一:插入数据: 在数据库中所有的字符串类型,必须使用单引号 1. insert into `authors` (aut_name,gander,country,brithday,hobby) values ('罗曼罗兰','女','漂亮国','1969-1-14','旅游'); 2. insert 阅读全文

posted @ 2023-04-20 10:55 不是小朋友L 阅读(152) 评论(0) 推荐(0)

建表约束

摘要: NOT NULL 非空 UNIQUE 唯一约束 ,意味这个值是不可以重复的,也是不可以为空的。。。 2种写法: PRIMARY KEY 主键约束(主关键字),自带非空、唯一、索引 DEFAULT 默认值 给这个一个缺省值,比如默认填入的人的性别为男 如果为给设定了默认约束的列赋值,该列会自动填充默认 阅读全文

posted @ 2023-04-20 09:04 不是小朋友L 阅读(30) 评论(0) 推荐(0)

2023年4月19日

Mysql中的数据类型注意事项

摘要: 整型数据类型 MySQL数据类型含义(有符号) tinyint 1字节,范围(-128~127) smallint 2字节,范围(-32768~32767) mediumint 3字节,范围(-8388608~8388607) int 4字节,范围(-2147483648~2147483647) b 阅读全文

posted @ 2023-04-19 08:06 不是小朋友L 阅读(193) 评论(0) 推荐(0)

导航