随笔分类 -  枚举

摘要:#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 1e3+10; // 每个月的天数,2月暂时设为29天,后续会根据闰年和平年调整 int a[13] = {0, 31, 29, 31, 3 阅读全文
posted @ 2024-10-17 16:50 CRt0729 阅读(5) 评论(0) 推荐(0) 编辑
摘要:思路分析 1. 定义十全数:十全数是指一个数的各位数字之和等于10的数。 2. 输入处理:程序首先读取一个正整数k,表示需要找到的第k个十全数。 枚举正整数:从1开始,逐个检查每个正整数是否是十全数。 4. 检查函数check: 计算一个数n的各位数字之和。 如果和等于10,返回true,否则返回f 阅读全文
posted @ 2024-10-17 16:49 CRt0729 阅读(16) 评论(0) 推荐(0) 编辑
摘要:思路分析 1. 输入处理:程序首先读取地毯的数量n。然后依次读取每张地毯的信息,包括左下角坐标(a, b)和尺寸(c, d),并存储在数组中。 查询点的输入:读取要查询的点的坐标(x, y)。 3. 检查覆盖: 从最后一张地毯开始,依次向前检查每张地毯是否覆盖点(x, y)。 检查条件是:x在地毯的 阅读全文
posted @ 2024-10-17 16:47 CRt0729 阅读(5) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e4+10, inf = 0x3f3f3f3f; int a[N], vis[2 * N]; // vis数组用于标记哪些数在集合中 i 阅读全文
posted @ 2024-10-17 16:40 CRt0729 阅读(11) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e3+10, inf = 0x3f3f3f3f; int a[N], vis[N]; int n, ans; // 计算函数:根据运算符 阅读全文
posted @ 2024-10-17 16:36 CRt0729 阅读(32) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; int main() { int a, b; cin >> a >> b; // 读取输入的两个整数A和I int k = a * b; // 初始化k为A和I的乘积 while (1) { // 无限循环,直 阅读全文
posted @ 2024-10-17 16:34 CRt0729 阅读(35) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e3+10,inf = 0x3f3f3f3f; int main() { int x,y,z,n,m; cin >> x >> y >> 阅读全文
posted @ 2024-10-17 16:32 CRt0729 阅读(7) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 1e3+10; int c; bool check(int a,int b) { if(a + b <= c) return 0; //不构 阅读全文
posted @ 2024-10-17 16:31 CRt0729 阅读(31) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 1e3+10; bool check(int x) { int sum = 0,m = x; //分割m,然后计算次方和sum while( 阅读全文
posted @ 2024-10-17 16:28 CRt0729 阅读(43) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define ll long long using namespace std; const int N = 1e3+10; int main() { for(int i = 100; i <= 999; i++) { //判断i是水仙花数 int 阅读全文
posted @ 2024-10-17 16:25 CRt0729 阅读(4) 评论(0) 推荐(0) 编辑
摘要:解决思路 计算总和:首先计算所有神秘物品的神秘指数和 sum。 枚举分组数:从 n 开始枚举分组数 i,尝试将神秘物品分成 i 组。 检查分组可行性:对于每个分组数 i,检查是否可以将神秘物品分成 i 组且每组的神秘指数和相同。 输出结果:找到最小的可行分组数 i,输出每组的神秘指数和。 #incl 阅读全文
posted @ 2024-09-30 16:51 CRt0729 阅读(51) 评论(0) 推荐(0) 编辑
摘要:解决思路 读取输入:读取糖果的数量 n 和每个糖果距左边第一颗糖果的距离。 排序:对糖果的距离进行排序。 枚举分割点:枚举两个分割点,将糖果分成三段,计算每段的长度,并求出总长度的最小值。 #include <bits/stdc++.h> #define ll long long using nam 阅读全文
posted @ 2024-09-30 16:49 CRt0729 阅读(31) 评论(0) 推荐(0) 编辑
摘要:解决思路 计算总距离:首先计算贝茜不跳过任何检查点的总行进距离。 尝试跳过每个检查点:对于每个可以跳过的检查点,计算跳过该检查点后的行进距离,并记录最小的行进距离。 输出结果:输出最小的行进距离。 #include <bits/stdc++.h> #define ll long long using 阅读全文
posted @ 2024-09-30 16:46 CRt0729 阅读(18) 评论(0) 推荐(0) 编辑
摘要:因为它,我学会了sscanf ^^ #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e3+10,inf = 0x3f3f3f3f; map<string,int> p; int n; 阅读全文
posted @ 2024-06-28 15:15 CRt0729 阅读(17) 评论(0) 推荐(0) 编辑
摘要:NB,标签大王 也可以知道,就是队列模拟了 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 3e5+10; struct node{ int t,x; }; queue<node>q; 阅读全文
posted @ 2024-06-28 15:14 CRt0729 阅读(11) 评论(0) 推荐(0) 编辑
摘要:解法一:我也不记得怎么做了,就记得好像是不断拼接字符串,然后用map做判断去重 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e3+10,inf = 0x3f3f3f3f; int 阅读全文
posted @ 2024-06-28 15:12 CRt0729 阅读(77) 评论(0) 推荐(0) 编辑
摘要:转自:lugo的题解,注释比较多,还算是比较清晰 #include<iostream> #include<cstring> #include<algorithm> #include<cmath> using namespace std; int x11,y11,x22,y22,minn=400001 阅读全文
posted @ 2024-06-28 15:09 CRt0729 阅读(29) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define f(i,s,e) for(int i=s;i<=e;i++) using namespace std; typedef long long ll; const int N=1e6+10,inf=0x3f3f3f3f; int a[N], 阅读全文
posted @ 2024-06-28 15:08 CRt0729 阅读(51) 评论(0) 推荐(0) 编辑
摘要:思路:每次找出剩下瓶子的最小值,交换到前面去 #include<bits/stdc++.h> #define f(i,s,e) for(int i = s; i <= e; i++) #define ll long long using namespace std; const int N = 1e 阅读全文
posted @ 2024-06-28 15:04 CRt0729 阅读(7) 评论(0) 推荐(0) 编辑
摘要:#include<bits/stdc++.h> #define f(i,s,e) for(int i = s; i <= e; i++) #define ll long long using namespace std; const int N = 1e4+10,inf = 0x3f3f3f3f; 阅读全文
posted @ 2024-06-28 14:59 CRt0729 阅读(23) 评论(0) 推荐(0) 编辑

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