题解列表

筛选

dp--最长上升子序列模型//闫氏dp法

摘要:# dp基础入门 上升子序列模型 ## 闫氏dp法 同系列基础dp算法链接:[dp--数字三角形模型](https://blog.dotcpp.com/a/106383 "dp--数字三角形模型"……

STL不好用,结构体解决

摘要:注意事项:按列表B的出现顺序输出是难点,map是自动排序的,unordered_map是随机排序的,不好解决输出顺序问题。参考代码:#include<bits/stdc++.h> using nam……

dp--数字三角形模型系列//闫氏dp法

#闫氏dp法######跟着y总学过算法的都知道y总的dp分析思路很nb在这里分享一下![](/image_editor_upload/20240915/20240915022348_59424.jpg)######做dp不能想着怎么得到最大最优而是要思考得到的过程;;######所以我们很简单的就能

dfs--字符转数存状态//[LETTERS]

#利用Ascall码性质将字符转为数字存在数组跟新状态######话说unordered_map也有这种性质但是我用他wa了一个点首先看到最多最长类似的字样首先想到的是深搜当然要注意回溯、本题简单就不多啰嗦看代码注释;######Code:```cpp#include#include#include#

map哈希存储

摘要:参考代码:#include<bits/stdc++.h> using namespace std; int main() { int n; while(cin>>n) { if……

[LETTERS] BFS 配合 map容器

##unordered_map的.count函数-用于查找是否出现过该状态,是返回1;```cpp#include#defineULLunsignedlonglong#defineLLlonglong#definePIIpairusingnamespacestd;constintN=1e7+10,

筛素数最全模板

###暴力筛素数(O(sqrt(n)))#include#includeusingnamespacestd;boolprimes(intx){if(x==2)returntrue;for(inti=2;i

单调栈(可做模板)

##优化版(O(n))###手写栈版#include#includeusingnamespacestd;constintN=5000;inta[N],tt;intmain(void){ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);intn;cin

[蓝桥杯2017年第八届真题-九宫幻方] DFS

##思路:先找出未用的数字有哪些,再进行深搜找出全排列的数,然后放入九宫格中,最后进行检测看是否符合题意```cpp#include#defineULLunsignedlonglong#defineLLlonglong#definePIIpairusingnamespacestd;constintN=