02 2019 档案
摘要:1 #include 2 #include 3 struct node 4 { 5 int a; 6 struct node*next; 7 }; 8 int main() 9 { 10 int n,d; 11 scanf("%d",&n); 12 struct node*head,*p,*taile,*q; 13 head=...
阅读全文
摘要:1 #include 2 #include 3 #include 4 struct node 5 { 6 int data; 7 struct node*next; 8 }; 9 int main() 10 { 11 int n,i,j=0,o=0;//o、j分别用来统计偶数和奇数的个数。 12 scanf("%d",&n);//题目比较简...
阅读全文
摘要:1 #include 2 #include 3 int main() 4 {//枚举又叫穷举算法,基本思想就是有序的去尝试每一种可能=.=。 5 char name[20]; 6 while (scanf("%s",name)!=EOF) 7 { 8 if(strcmp(name,"red")==0) 9 pr...
阅读全文
摘要:1 #include 2 #include 3 union node//公用体修改一个数据就会影响别的数据。 4 {//思路和结构体差不多。 5 int a; 6 double b; 7 char c[30]; 8 } q[100001]; 9 char str[100001][30]; 10 int main() 11 { 12 int m...
阅读全文
摘要:1 #include 2 #include 3 struct node 4 { 5 int w,j; 6 } th[100],t; 7 int main() 8 { 9 int i,j,n; 10 while(scanf("%d",&n)!=EOF) 11 { 12 for(i=0; ith[j+1].w) 25 ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 struct node 5 { 6 int a;//结构体。 7 int s; 8 } st[10000],t; 9 int main() 10 { 11 int n,i,j,T; 12 scanf("%d",&T); 13 while(T--) 14 {...
阅读全文
摘要:1 #include 2 #include 3 #include 4 struct node 5 { 6 int a;//结构体。 7 char s[20]; 8 } st[50],t; 9 int main() 10 { 11 int n,i,j; 12 while(scanf("%d",&n)!=EOF) 13 { 14 ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 struct node 5 { 6 int a,b;//结构体。 7 } st[5000]; 8 int main() 9 { 10 int i,n,max,temp; 11 while(scanf("%d",&n)!=EOF) 12 { 13 max=0...
阅读全文
摘要:1 #include 2 #include 3 #include 4 struct node 5 { 6 int a,b; 7 char s[20];//结构体。 8 } st[1001],t; 9 int main() 10 { 11 int i,n,a,b,c,d,j,cnt=0; 12 scanf("%d",&n); 13 f...
阅读全文
摘要:1 #include 2 #include 3 #include 4 struct node 5 { 6 int date;//结构体。 7 } a[1001]; 8 int main() 9 { 10 int i,n,m,t,max,temp; 11 scanf("%d %d",&n,&m); 12 memset(a,0,sizeof(a...
阅读全文
摘要:1 #include 2 #include 3 struct node 4 { 5 int w1,w2,w3;//结构体。 6 } a[5000]; 7 int main() 8 { 9 int n,i,l,max,temp; 10 while(~scanf("%d",&n)) 11 { 12 max=0; 13 ...
阅读全文
摘要:1 #include 2 #include 3 struct node 4 { 5 int date;//结构体。 6 } a[100]; 7 int main() 8 { 9 int n,cnt; 10 int b,c,d,e,f,g,i,max=0; 11 while(~scanf("%d",&n)) 12 { 13 ...
阅读全文
摘要:1 #include 2 #include 3 struct node 4 { 5 int data; 6 struct node*next; 7 }; 8 int main() 9 { 10 int n,i; 11 struct node*head,*p,*end,*q; 12 head=(struct node*)malloc(s...
阅读全文
摘要:1 #include 2 #include 3 struct node 4 { 5 int data; 6 struct node*next; 7 }; 8 int main() 9 { 10 int n,i; 11 struct node*head,*p; 12 head=(struct node*)malloc(sizeof(st...
阅读全文
摘要:1 #include 2 #include 3 struct node 4 { 5 int data; 6 struct node*next; 7 }; 8 int main() 9 { 10 int n,i; 11 struct node*head,*end,*p; 12 head=(struct node*)malloc(size...
阅读全文
摘要:1 #include 2 #include 3 char s[100]; 4 int b;//b用来统计输入的字符串遍历到哪里了。 5 struct node 6 { 7 struct node*left,*right; 8 char c;//定义一颗二叉树。 9 }; 10 struct node *creat() 11 { 12 struct ...
阅读全文
摘要:1 #include 2 #include 3 #include 4 struct node 5 { 6 int data; 7 }a[100000]; 8 int main() 9 { 10 int n,m; 11 int i,d; 12 memset(a,0,sizeof(a)); 13 scanf("%d %d",&n,&m)...
阅读全文
摘要:1 #include 2 #include 3 int merge[100000],keep[100000];//merge数组用来寻找记录最终节点的数组,keep用来记录是否存在某个点。 4 int root(int x)//用来寻找最终节点。 5 { 6 while(x!=merge[x]) 7 x=merge[x];//不断地循环,知道找到最终节...
阅读全文
摘要:1 #include 2 #include 3 int map[1000][1000],visit[1000]; 4 int step,mark; 5 int queue[1000];//用来储存已经遍历了的数据。 6 void BFS(int k) 7 { 8 int i,o=0,p=0,temp,end=0;//temp用来表示当前所在地。o表示下一步从哪个顶点向下出...
阅读全文
摘要:1 #include 2 #include 3 int map[100][100]; 4 int visit[100]; 5 int k,n;//k在这里定义防止在DFS函数中再次定义使代码繁琐。 6 void DFS(int t)//DFS函数(深度优先搜索)。 7 { 8 int i;//t表示此时我们处于哪个“点”。 9 visit[t]=1;//将数...
阅读全文
摘要:1 #include 2 void sort(int a[],int left,int right)//可以理解为一个区域的数据和左、右端点。 3 { 4 int temp=a[left],i=left,j=right;//temp的作用是将一个数值储存起来,因为两个数值无法做到直接交换,要有一个中间变量。 5 if(i>=j)return;//当右端点在左端点左边或...
阅读全文