1 2 3 4 5 ··· 8 下一页
摘要: #include <bits/stdc++.h> using namespace std; bool a1[2][2]={false}; int d[4][2]={{0,-1},{0,1},{1,0},{-1,0}}; vector<pair<int,int>> path; void dfs(int 阅读全文
posted @ 2025-04-19 10:00 hanxuyao 阅读(10) 评论(0) 推荐(0)
摘要: //深搜:dfs //怎么获取二维数组长度 //1.sizeof(a)/sizeof(int) //2.在所有循环中:关于STL容器可以使用auto自动遍历 // for(auto a1 : a){ // cout<<a1[0]<<" "<<a1[1]<<endl; // } //dfs口诀: 1. 阅读全文
posted @ 2025-04-18 19:29 hanxuyao 阅读(10) 评论(0) 推荐(0)
摘要: #include <graphics.h> #include <conio.h> void three(int a,int b,int c) { line(a,b,a-c/2,b+c); line(a,b,a+c/2,b+c); line(a+c/2,b+c,a-c/2,b+c); } void f 阅读全文
posted @ 2025-04-12 09:59 hanxuyao 阅读(14) 评论(0) 推荐(0)
摘要: #include<iostream> #include<vector> #include<algorithm> using namespace std; bool greater3(int a){ return a>3; } void shuchuv1(vector<int> v){ vector< 阅读全文
posted @ 2025-03-21 19:26 hanxuyao 阅读(10) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; class bank{ private: string name; double money; vector<string> log; string password; string str; string 阅读全文
posted @ 2025-03-08 09:59 hanxuyao 阅读(8) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> #include <vector> #include <algorithm> using namespace std; bool greater3(int a) { return a>3; } int main() { vector<int> v; 阅读全文
posted @ 2025-03-01 09:52 hanxuyao 阅读(8) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; struct mp{ string name; string jn; }; struct rw{ }; int main() { cout<<"那一年,我重生了!"<<endl; cout<<"请选择你的种族 阅读全文
posted @ 2024-12-28 09:58 hanxuyao 阅读(22) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> using namespace std; int main() { int n,k,a[100000],sum=0; cin>>n>>k; for(int i=1;i<=n;i++) { cin>>a[i]; } int l=1,r=10000000 阅读全文
posted @ 2024-12-21 09:01 hanxuyao 阅读(11) 评论(0) 推荐(0)
摘要: 贪心算法 贪心算法基本要素 1.贪心选择性质:通过每个子问题的最优选择,可以得到整个问题的最优解。 意味着,当我们面对一个问题时,我们就可以通过贪心策略来做出局部最优 的选择,最终得到全局最优的解。 2.最优子结构:问题的最优解包含子问题的最优解。意味着,问题可以分解 成若干个子问题,每个子问题可以 阅读全文
posted @ 2024-10-19 14:43 hanxuyao 阅读(48) 评论(0) 推荐(0)
摘要: //mysocket.h #ifndef __MYSOCKET_H__ #define __MYSOCKET_H__ //头文件保护 #include<bits/stdc++.h> #include<winsock.h> #pragma comment(lib,"ws2_32.lib") using 阅读全文
posted @ 2024-09-07 09:36 hanxuyao 阅读(34) 评论(0) 推荐(0)
1 2 3 4 5 ··· 8 下一页