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 阅读(29) 评论(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 阅读(13) 评论(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 阅读(13) 评论(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 阅读(421) 评论(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 阅读(12) 评论(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 阅读(138) 评论(0) 推荐(0) 编辑

建表约束

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

posted @ 2023-04-20 09:04 不是小朋友L 阅读(13) 评论(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 阅读(107) 评论(0) 推荐(0) 编辑

2023年3月30日

二分答案--木材加工

摘要: P2440 木材加工 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 直接暴力枚举如下: #include <iostream> #include <algorithm> #include <cstring> #include <vector> using namespace st 阅读全文

posted @ 2023-03-30 11:00 不是小朋友L 阅读(15) 评论(0) 推荐(0) 编辑

2023年3月29日

二分查找模板题--简单多次二分查询

摘要: AcWing 789. 数的范围给定一个按照升序排列的长度为 n 的整数数组,以及 q 个查询。 对于每个查询,返回一个元素 k 的起始位置和终止位置(位置从 0 开始计数)。 如果数组中不存在该元素,则返回 -1 -1。 输入格式第一行包含整数 n 和 q,表示数组长度和询问个数。 第二行包含 n 阅读全文

posted @ 2023-03-29 14:56 不是小朋友L 阅读(13) 评论(0) 推荐(0) 编辑

导航