随笔分类 - c++
摘要:c++ 网络编程 标签(空格分隔): c++ [toc] 建立socket int socket(int domain,int type ,int protocol); domain 通常为 PF_INET ,表示互联网协议(TCP/IP) type 指定了Socket的类型 SOCK_STREAM
阅读全文
摘要:int par[maxn]//父亲 int rank[maxn]//树的高度 //初始化n个元素 void init(int n) { for(int i=0;i<n;i++) { par[i]=i; rank[i]=0; } } //查询树的根 int find(int x) { if(par[x]==x) { ...
阅读全文
摘要://表示节点的数据结构 struct node { int val; node *lch,*rch; }; //插入数值 node *insert(node *p,int x) { if(p==NULL) { node *q=new node; q->val=x; q->lch=q->rch=NULL; ...
阅读全文
摘要:int heap[MAX_N],int sz=0; void push(int x) { int i=sz++; while(i>0) { int p=(i-1)/2;//得到父节点 if(heap[p]=x) break; heap[a]=x; i=a; } heap[i]=x; ...
阅读全文
摘要:.定义一个二维数组 char **array1 array1 = new char *[x]; for(i=0;i<x;++i) array1[i] = new char[y]; ...用的时候可以直接array1[i][j] 注意delete for(i=0;i<x;++i) delete[] a
阅读全文
摘要:#include<bits/stdc++.h> using namespace std; int main() { int n; cin>>n; string str; while(n--) { cin>>str; string two; int len=str.length(); for(int
阅读全文
摘要:int 1e6 long 1e9; long long 1e18;
阅读全文