随笔分类 -  蓝桥杯

摘要:第一个难点:如何枚举第一行的操作(指数类型的枚举,可以使用第一题的指数型枚举) 这里使用二进制类型枚举 1 1 0 1 0 = 26 反过来任何一个整数0-65536 也可以用二进制表示 第一行有5个数,2的5次方等于32 0-31 代表每一种方案; 怎样看第i位是不是1; i>>k & 1 第二个 阅读全文
posted @ 2022-11-06 18:05 努力、奋斗啊 阅读(43) 评论(0) 推荐(0) 编辑
摘要:// 转换为目标状态 #include<iostream> #include<algorithm> #include<cstring> using namespace std; const int N=110; char start[N]; //初始状态 char aim[N]; // 目标状态 i 阅读全文
posted @ 2022-11-04 12:01 努力、奋斗啊 阅读(21) 评论(0) 推荐(0) 编辑
摘要:// 递推 // 数列 0 1 1 2 3 5 8 13 21 ... 被称为斐波纳契数列 #include<iostream> #include<cstring> using namespace std; const int N=50; int n; int f[N]; int main(){ c 阅读全文
posted @ 2022-11-01 08:50 努力、奋斗啊 阅读(13) 评论(0) 推荐(0) 编辑
摘要:题目条件: 枚举全排列,是9个数 a,b,c的位数都还不知道 枚举a,b,c的位数,枚举a和b的位数 ,c=9-a-b 判断等式是否成立 // 暴力dfs #include<iostream> #include<cstring> #include<algorithm> using namespace 阅读全文
posted @ 2022-10-30 10:00 努力、奋斗啊 阅读(19) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N=30; // 多开几个,防止边界越界 int n,m; int way[N]; // 表示方案 // u 代表当前枚举的 阅读全文
posted @ 2022-10-29 13:56 努力、奋斗啊 阅读(32) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; const int N=10; int n; int path[N]; // 0表示没有放数, 1-n表示放的 阅读全文
posted @ 2022-10-28 09:02 努力、奋斗啊 阅读(20) 评论(0) 推荐(0) 编辑
摘要:题解1: // 指数型枚举 // 题意是给出得数字都有两种选择,选或者不选 // 画出递归树理解题意 #include<iostream> #include<cstring> #include<algorithm> using namespace std; const int N=16; int n 阅读全文
posted @ 2022-10-28 08:35 努力、奋斗啊 阅读(26) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示