diff --git a/20240919/CSP常考算法模板/二分查找_加速查询.cpp b/20240919/CSP常考算法模板/二分查找_加速查询.cpp index 0b9d079..200d34c 100644 --- a/20240919/CSP常考算法模板/二分查找_加速查询.cpp +++ b/20240919/CSP常考算法模板/二分查找_加速查询.cpp @@ -1,3 +1,4 @@ +#include #include using namespace std; @@ -5,6 +6,11 @@ int a[11]={5, 13, 19, 21, 37, 56, 64, 75, 80, 88, 92}; int main() { + //C++ stl 二分查找 + // std::upper_bound() + // std::lower_bound() + + int x; cin>>x; int l=0,r=10; diff --git a/20240919/CSP常考算法模板/全排列.cpp b/20240919/CSP常考算法模板/全排列.cpp index 31415ce..ac4c6de 100644 --- a/20240919/CSP常考算法模板/全排列.cpp +++ b/20240919/CSP常考算法模板/全排列.cpp @@ -1,3 +1,4 @@ +#include #include using namespace std; bool book[10]; //false表示没用过 @@ -14,6 +15,8 @@ void print() void dfs(int step) { + //C++ stl + //std::next_permutation() if(step==5) { print(); diff --git a/20240919/CSP常考算法模板/最小生成树/最小生成树_Prim(稠密图)..cpp b/20240919/CSP常考算法模板/最小生成树/最小生成树_Prim(稠密图)..cpp index aedb674..913f4c2 100644 --- a/20240919/CSP常考算法模板/最小生成树/最小生成树_Prim(稠密图)..cpp +++ b/20240919/CSP常考算法模板/最小生成树/最小生成树_Prim(稠密图)..cpp @@ -1,4 +1,5 @@ #include +#include using namespace std; struct edge { @@ -26,7 +27,7 @@ int main() { graph[a].push_back({b,c}); graph[b].push_back({a,c}); } - for (int i = 1; i <= n; i++) { + for (int i = 1; i <= n; i++) { dis[i]=INT_MAX/2; } visit[1]=true;