板子 热浪acwing 1129

AcWing 99. 激光炸弹

......
炸弹 激光 AcWing 99

AcWing905.区间选点

# 题目详情 ![](https://img2023.cnblogs.com/blog/2826001/202305/2826001-20230522193234818-1657453835.png) # 知识点 区间贪心 **为什么叫贪心呢?** ——**短视**,每次只是在看眼前的东西,在眼前的 ......
区间 AcWing 905

AcWing901. 滑雪(python)

# 题目详情 ![](https://img2023.cnblogs.com/blog/2826001/202305/2826001-20230522162406198-673075706.png) ![](https://img2023.cnblogs.com/blog/2826001/20230 ......
AcWing python 901

AcWing900.整数划分(python)

# 题目详情 ![](https://img2023.cnblogs.com/blog/2826001/202305/2826001-20230522152834670-504842011.png) # 知识点 **计数类DP** 分析题目,k个数是默认排好序的,也就是说,对于划分我们的考虑是无序的 ......
整数 AcWing python 900

AcWing 777. 字符串乘方

AcWing 777. 字符串乘方 1. 地址 https://www.acwing.com/problem/content/779/ 2. 题解 #include <iostream> #include <cstdio> using namespace std; /* 算法思路: 通过本题性质,我 ......
乘方 字符串 字符 AcWing 777

AcWing 776. 字符串移位包含问题

AcWing 776. 字符串移位包含问题 1. 地址 https://www.acwing.com/problem/content/778/ 2. 题解 #include <iostream> #include <cstdio> #include <string> #include <algori ......
字符串 字符 AcWing 问题 776

AcWing 771. 字符串中最长的连续出现的字符

AcWing 771. 字符串中最长的连续出现的字符 1. 地址 https://www.acwing.com/problem/content/description/773/ 2. 题解 #include <iostream> #include <cstdio> #include <string> ......
字符 字符串 AcWing 771

Acwing周赛102

倍增 这是一道简单数论题 using namespace std; typedef long long LL; const int N = 1e5 + 10; int a[N], n; int div(int x) { if(x % 2 == 0) while(x % 2 == 0) x /= 2; ......
Acwing 102

AcWing 770. 单词替换

AcWing 770. 单词替换 1. 地址 https://www.acwing.com/problem/content/772/ 2. 题解 #include <iostream> #include <cstdio> #include <sstream> using namespace std; ......
单词 AcWing 770

POJ2739 Sum of Consecutive Prime Numbers&&Acwing4938 连续质数之和

方法:单调队列 为什么是单调队列?因为这里让我们求连续的质数和,我们可以利用欧拉筛来维护质数,再利用单调队列来维护连续的质数。 代码( ~~POJ 不支持 C++ 11 差评~~): #include<cstdlib> #include<cstring> #include<cstdio> #incl ......
质数 之和 Consecutive amp Numbers

acwing 4645. 选数异或

输出yes no yes no 题意分析,给一串数组,再在每次提问时给出一个区间,l,r; 求l,r区间内是否存在两个数,两数异或后值为给出的x; 已知a^b=x-->a^x=b; 思路:1,把每个数异或x,存在另一个数组(b)里,暴力搜索,看区间内b数组内数字是否有等于a数组内数字,TLE 2.记 ......
acwing 4645

AcWing 3549. 最长非递减子序列

$AcWing$ $3549$. 最长非递减子序列 一、题目描述 给定一个长度为 $n$ 的数字序列 $a_1,a_2,…,a_n$,序列中只包含数字 $1$ 和 $2$。 现在,你要选取一个区间 $l,r$,将 $a_l,a_{l+1},…,a_r$ 进行翻转,并且使得到的新数字序列 $a$ 的最 ......
序列 AcWing 3549

AcWing 1209. 带分数

1-暴力解法 思考1:暴力列举出1~9的全排列,之后再将这些数字按照一定规则相加,最后将结果与n比较。全排列好写,但相加的规则不好写,而且太暴力了,估计会超时。 /* AcWing 1209. 带分数 00.最暴力的写法 1.枚举全排列 2.枚举位数(枚举a和b,可算出c) 3.直接算出n,判断等式 ......
带分数 AcWing 1209

AcWing 756. 蛇形矩阵

AcWing 756. 蛇形矩阵 1. 地址 https://www.acwing.com/problem/content/description/758/ 2. 题解 #include <iostream> #include <cstdio> using namespace std; //通过四个 ......
蛇形 矩阵 AcWing 756

AcWing 754. 平方矩阵 II

AcWing 754. 平方矩阵 II 1. 地址 https://www.acwing.com/problem/content/756/ 2. 题解 #include <iostream> #include <cstdio> #include <cmath> using namespace std ......
矩阵 AcWing 754 II

AcWing 753. 平方矩阵 I

AcWing 753. 平方矩阵 I 1. 地址 https://www.acwing.com/problem/content/755/ 2. 题解 #include <iostream> #include <cstdio> #include <cmath> using namespace std; ......
矩阵 AcWing 753

AcWing 727. 菱形

AcWing 727. 菱形 1. 地址 https://www.acwing.com/problem/content/description/729/ 2. 题解 #include <iostream> #include <cstdio> #include <cmath> using namesp ......
菱形 AcWing 727

AcWing 726. 质数

AcWing 726. 质数 1. 地址 https://www.acwing.com/problem/content/728/ 2. 题解 // 此题跟完全数这道题差不多 #include <iostream> #include <cstdio> #include <cmath> using na ......
质数 AcWing 726

KMP板子

P3426 #include <cstdio> #include <cstring> #include <vector> #define sd std:: namespace m{ // } constexpr int LEN = 1e6; sd vector<int> prepare(char* ......
板子 KMP

AcWing 725. 完全数

AcWing 725. 完全数 1. 地址 https://www.acwing.com/problem/content/description/727/ 2. 题解 #include <iostream> #include <cstdio> #include <cmath> using names ......
全数 AcWing 725

高精度板子

百度百科> #include<iostream> #include<vector> #include<string> using namespace std; struct wint:vector<int> { wint(int n=0) { push_back(n); check(); } win ......
高精 板子 高精度

AcWing 4086 分糖果

关于这道题我当时大意了 https://www.acwing.com/problem/content/description/4089/ 关于我的某个变量没有初始化这件事,唯一想法,敲死得了,谁懂? 其实就是一道简简单单的数学分析题,和大佬们不一样,萌新只会简简单单的小学数学(本人初二!) 分析走起 ......
糖果 AcWing 4086

AcWing 656. 钞票和硬币

AcWing 656. 钞票和硬币 1. 地址 https://www.acwing.com/problem/content/658/ 2. 解答 #include <iostream> #include <cstdio> using namespace std; int main(){ int m ......
硬币 钞票 AcWing 656

bitset 相关板子

二分图匹配 dfs 版: https://uoj.ac/submission/619931 #define N 505 int n,m; int bel[N]; bitset<N>e[N],nvis; bool match(int u){ for(int i=(e[u]&nvis)._Find_fi ......
板子 bitset

换根 DP 板子

以前一直以为这玩意是随机应变的。 结果还真能总结出板子。 当然也有一定的局限性,比如 $dp$ 值必须 $O(1)$ 算。但不影响正常使用。 ins:向 $k$ 的子树信息中插入/删除 $nx$ 的子树信息。 这里的 子树 在 dfs1 中是指以 $1$ 为根的子树;dfs2 中是指以 $k$ 为根 ......
板子 DP

AcWing 242. 一个简单的整数问题 / 树状数组区间修改区间查询模板题

AcWing 242. 一个简单的整数问题 // 实例化是抽象的天敌,是抽象的克星 // 通过公式 sn = (i 从 1 ~ n 求积) di * (1 + n) - (i 从 1 ~ n 求积) i * di // 来计算前缀和, 又 (i 从 1 ~ n 求积) i * di 不能由 (i 从 ......
区间 整数 数组 模板 AcWing

AcWing 241. 楼兰图腾 / 树状数组 + 在线隔离数据 + 变为 1 统计和

AcWing 241. 楼兰图腾 #include <iostream> #include <cstring> using namespace std; const int N = 2e5 + 10; typedef long long LL; int n, a[N], tr[N]; LL high ......
数组 图腾 数据 AcWing 241

Acwing 3728-城市通电 / 最小生成树,建图,超级源点

AcWing 3728. 城市通电 做出来就凭之前的一句感悟:把每个动态选择变为与超级源点连的一条边,把这条边加入图里面跑最小生成树就相当于考虑了每个动态选择 ......
通电 Acwing 城市 3728

AcWing 788 逆序对的数量

788. 逆序对的数量 - AcWing题库 逆序对,即位置顺序与大小顺序不符的数对,也就是对于一个期望升序的序列Num[],当i<j时,Num[i]>Num[j] 这道题要求求出逆序对的个数,显然在归并排序的过程中我们就是在逐步的消除逆序对,所以我们可以在递归的排序过程中求出逆序对的个数 已知归并 ......
逆序 数量 AcWing 788

Acwing 3696-构造有向无环图 / 拓扑排序 / 指定无向边的方向,让其和有向边一起构造成一个拓扑图

Acwing 3696-构造有向无环图 开始想了半天没想明白,后来突然想到这个题目这个名称,或许是一个模板题。我不知道是不是模板题,但我当模板题记下来,因为我理解不了。 操作: 1. 读边时有向边指向的点入度增加,无向边入度都为 0, 用结构体存下所有无向边 2. 进行一次 top_sort,只要点 ......
拓扑 拓扑图 方向 Acwing 3696