04 2022 档案
摘要:题目链接:https://codeforces.com/problemset/problem/1242/B 题目大意: 给定一个包含 个节点的完全图,图中有 条长度为 的边(\(0 \le m \le \min(\frac{n(
阅读全文
摘要:A. 4070. 异或 题目链接:https://www.acwing.com/problem/content/4073/ 题目大意:略。 解题思路:简单模拟。 示例程序: #include <bits/stdc++.h> using namespace std; int n, a[11], res
阅读全文
摘要:A. 4003. 完全平方数 题目链接:https://www.acwing.com/problem/content/4006/ 题目大意:求 个数中最大的非完全平方数。 解题思路:循环一遍即可。 示例程序: #include <bits/stdc++.h> using namespac
阅读全文
摘要:题目链接:https://www.luogu.com.cn/problem/SP3267 参考链接:https://www.cnblogs.com/cjjsb/p/9539388.html 题目大意: 区间询问共有多少不同数值。 示例程序: #include <bits/stdc++.h> usin
阅读全文
摘要:A. 4000. 排位 题目链接:https://www.acwing.com/problem/content/4003/ 题目大意:略。 解题思路:小明的位置 示例程序: #include <bits/stdc++.h> using namespace
阅读全文
摘要:A. 3997. 整数幂 题目链接:https://www.acwing.com/problem/content/4000/ 题目大意:略。 解题思路:只要 l % k == 0 就执行 l /= k ,判断最终 l 是否变为 1。特判初始 l == 1 是 NO,因为 n 是正整数。 示例程序:
阅读全文
摘要:A. 3994. 水果派 题目链接:https://www.acwing.com/problem/content/3997/ 题目大意:略。 解题思路:向上取整。 示例程序: #include <bits/stdc++.h> using namespace std; int T, a, b, c,
阅读全文
摘要:A. 3991. 满足条件的01串 题目链接:https://www.acwing.com/problem/content/3994/ 题目大意:略。 解题思路:简单模拟一遍即可。 示例程序: #include <bits/stdc++.h> using namespace std; int T,
阅读全文
摘要:A. 3988. 不同的数 题目链接:https://www.acwing.com/problem/content/3991/ 题目大意:从n个数中找出k个不同的数,输出下标。 解题思路:用 set 记录有没有出现过,用 vector 保存数据。 示例程序: #include <bits/stdc+
阅读全文
摘要:A. 3971. 最小的商 题目链接:https://www.acwing.com/problem/content/3974/ 题目大意:从数组中找最大的 k 的因数,并输出 k 除以它的商。 解题思路:循环一遍就可以了。 示例程序: #include <bits/stdc++.h> using n
阅读全文
摘要:A. 3955. 统一大小写 题目链接:https://www.acwing.com/problem/content/3958/ 题目大意:略。 解题思路:循环一轮记录大小写字母出现次数,然后相应地进行大小写转换。 示例程序: #include <bits/stdc++.h> using names
阅读全文
摘要:A. 3826. 青蛙跳 题目链接:https://www.acwing.com/problem/content/3829/ 题目大意:略。 解题思路:简单数学题。 示例程序: #include <bits/stdc++.h> using namespace std; int T; long lon
阅读全文
摘要:A. 3821. 区间选数 题目链接:https://www.acwing.com/problem/content/3824/ 题目大意:在两个区间选两个不相同的数。 解题思路: ,不行就 。 示例程序: #include <bits/stdc+
阅读全文
摘要:A. 3811. 排列 题目链接:https://www.acwing.com/problem/content/3814/ 题目大意:构造一个 的排列。 解题思路:顺移一位。 示例程序: #include <bits/stdc++.h> using namespace
阅读全文
摘要:A. 3803. 数组去重 题目链接:https://www.acwing.com/problem/content/3806/ 题目大意:给数组去重,相同数字输出最右边一个。 解题思路:开一个 set 从右往左判断是否第一个出现,用 vis[] 数组标记是否要输出。 示例程序: #include <
阅读全文
摘要:A. 3795. 计算abc 题目链接:https://www.acwing.com/problem/content/3798/ 题目大意:已知三个正整数 ,告诉你 ,分别求 。 解题思路:比较简单所以直接
阅读全文
摘要:A. 3787. 整除 题目链接:https://www.acwing.com/problem/content/3790/ 题目大意:a 加几次 1 能够被 b 整除。 解题思路:如果 a % b == 0,则 0 次;否则,b - a % b 次。不用 if 的话用 (b - a % b) % b
阅读全文
摘要:A. 3778. 平衡数组 题目链接:https://www.acwing.com/problem/content/3781/ 题目大意: 次题目要求的操作使最终所有数都相等。 解题思路:思维题。将所有元素加上 等价于将这个数减去 。所以一种必定可行的方案就是一次操作
阅读全文
摘要:A. 3770. 最小消耗 题目链接:https://www.acwing.com/problem/content/description/3773/ 题目大意:按照题目要求消灭两种类型怪兽(可以消耗 c 转换)的最小消耗。 解题思路:循环记录 0 和 1 出现的次数,消灭一个 0 的最小消耗为 m
阅读全文
摘要:A. 3758. 距离零点的时刻 题目链接:https://www.acwing.com/problem/content/3761/ 题目大意:求 h 时 m 分过多少分钟到 0 分 0 秒。 解题思路:一条一共 分钟,所以答案为 (1440 - h*
阅读全文
摘要:A. AcWing 3733. 去掉一个元素 题目链接:https://www.acwing.com/problem/content/3736/ 题目大意:问共有多少个元素满足,在去掉该元素后,剩余元素的相加之和为一个偶数(注意,0 也算偶数)。 解题思路:若和为奇数,答案为奇数个数;若和为偶数,答
阅读全文
摘要:A. AcWing 3726. 调整数组 题目链接:https://www.acwing.com/problem/content/3729/ 题目大意:判断若干次 操作能否最终让所有值都相等。 解题思路: 个数奇偶性相同就行。 示例程序: #include <bits/std
阅读全文
摘要:A. AcWing 3694. A还是B 题目链接:https://www.acwing.com/problem/content/3697/ 题目大意:判断字符串中'A'还是'B'出现地多。 解题思路:循环一遍记个数。 示例程序: #include <bits/stdc++.h> using nam
阅读全文
摘要:A. AcWing 3660. 最短时间 题目链接:https://www.acwing.com/problem/content/3663/ 题目大意:求 的矩阵中所有各自到 的最短距离。 解题思路:四角的各自的距离的最大值。 示例程序: #incl
阅读全文
摘要:A. AcWing 3626. 三元一次方程 题目链接:https://www.acwing.com/problem/content/3629/ 题目大意:求出三元一次方程 的一组非负整数解。 解题思路:枚举 和 。 示例程序: #include
阅读全文
摘要:A. AcWing 3577. 选择数字 题目链接:https://www.acwing.com/problem/content/3580/ 题目大意:从两个数组种各选出一个数,使它们的和不包含在两个数列中。 解题思路:因为元素都是正整数,所以找最大值即可。 示例程序: #include <bits
阅读全文
摘要:A. AcWing 3547. 特殊数字 题目链接:https://www.acwing.com/problem/content/3550/ 题目大意:求最小的 的数位和为 的倍数的数。 解题思路:模拟。循环之数位,然后循环判断 的数位和是不是
阅读全文
摘要:A. AcWing 3544. 寻找变化前的01序列 题目链接:https://www.acwing.com/problem/content/3547/ 题目大意:给定一个 串,消掉连续的 个 后面的 。 解题思路:开个计数器记录连续的 出
阅读全文