//vector建图,顶点是数字,本质是邻接表;二维数组建图,顶点是数字,本质是邻接矩阵 #include<iostream> #define maxn 100 //定义一个合适的值作为无边的标志 using namespace std; int main(){ int n,e,w,v1,v2;// Read More
posted @ 2020-07-28 17:54
执着于风
Views(425)
Comments(0)
Diggs(0)
#include<iostream> #include<queue> using namespace std; struct BSTNode{ int data; BSTNode *left,*right; BSTNode(int x,BSTNode* L=NULL,BSTNode* R=NULL) Read More
posted @ 2020-07-28 17:53
执着于风
Views(84)
Comments(0)
Diggs(0)
#include <iostream> #define maxn 1005 using namespace std; int fa[maxn]; void init() { for(int i=1;i<maxn;++i) { fa[i]=i; } } int find_ancestor(int x) Read More
posted @ 2020-07-28 17:51
执着于风
Views(76)
Comments(0)
Diggs(0)
#include<iostream> #include<cmath> using namespace std; int col[10],sum=0; //为了直观,行与列下标都从1开始,范围1-8,col[]数组中存的是每一行皇后位置的列值 void queen(int i){ //i表示当前行 i Read More
posted @ 2020-07-28 17:50
执着于风
Views(101)
Comments(0)
Diggs(0)
//vector建图,顶点是数字,本质是邻接表;二维数组建图,顶点是数字,本质是邻接矩阵 #include<iostream> #include<vector> using namespace std; const int N = 100; struct Edge{ int to,value; }e Read More
posted @ 2020-07-28 17:49
执着于风
Views(384)
Comments(0)
Diggs(0)
#include<iostream> #define INF 100 //找一个合适的值作为最大值,表示无边 using namespace std; int n=4; //顶点数 int G[4][4]={ {INF,1,3,5}, {1,INF,2,INF}, {3,2,INF,4}, {5,I Read More
posted @ 2020-07-28 17:48
执着于风
Views(109)
Comments(0)
Diggs(0)
#include<iostream> #include<algorithm> #define maxn 10005 using namespace std; int fa[maxn]; void init(){ for(int i=0;i<maxn;i++){ fa[i]=i; } } int ge Read More
posted @ 2020-07-28 17:47
执着于风
Views(104)
Comments(0)
Diggs(0)
#include <iostream> #include <string> using namespace std; //获取next数组 int* getNext(string T) { int len = T.size(); //获取T的长度 int* next = new int[len]; Read More
posted @ 2020-07-28 17:46
执着于风
Views(126)
Comments(0)
Diggs(0)
#include<iostream> #define INF 10000 //取合适的值作为无穷大表示无边 using namespace std; int n=7; //顶点数 int G[7][7]= { {INF,9,INF,INF,INF,INF,INF}, {9,INF,12,5,INF, Read More
posted @ 2020-07-28 17:44
执着于风
Views(121)
Comments(0)
Diggs(0)
#include<iostream> #include<string> using namespace std; int judge(string S,string T){ int i,j; int s_len=S.size(); int t_len=T.size(); for(i=0;i<=s_l Read More
posted @ 2020-07-28 17:42
执着于风
Views(100)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号