03 2019 档案

摘要:1 #include 2 #include 3 int n,m;//并查集。 4 int a[100000]; 5 void creat()//用来给每个单位赋值的,每个单位的值代表他们的上一级。 6 { 7 int i; 8 for(i=1; i<=n; i++) 9 { 10 a[i]=i; 11 } 12 ret... 阅读全文
posted @ 2019-03-16 19:00 念文丶 阅读(210) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 4 int main() 5 { 6 int p,q; 7 while(~scanf("%d %d",&p,&q)) 8 { 9 printf("%d %d %d %d %d %d\n",p&&q,p||q,!p||q,((!p||q)&&(!q||p)),!(p&&q),!(p||q... 阅读全文
posted @ 2019-03-14 18:45 念文丶 阅读(272) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 int a[100000];//其实也就是快速排序,就是从大到小然后多个查询的过程。 4 void sort(int left,int right) 5 { 6 if(left>=right)return 0; 7 int temp,l,r; 8 l=left,r=right; 9 temp=a... 阅读全文
posted @ 2019-03-08 20:35 念文丶 阅读(568) 评论(0) 推荐(0) 编辑
摘要:#include #include int reckon(int x,int y) { int k; if(x==0) { k=y+1; } else { k=2*reckon(x-1,y); } return k; } int main() { int m,n;//假设开始没有石柱,只有... 阅读全文
posted @ 2019-03-08 19:44 念文丶 阅读(181) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 void recursive(int n,char A,char B,char C) 4 { 5 if(n==1)printf("Move disk %d from %c to %c\n",n,A,C);//每一个的第一步要把A上的一个移动到B上。 6 else 7 { 8 recursi... 阅读全文
posted @ 2019-03-08 19:05 念文丶 阅读(162) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 int recursive(int m,int n) 3 { 4 if(m==0)return n+1; 5 if(m>0&&n==0)return recursive(m-1,1); 6 if(m>0&&n>0)return recursive(m-1,recursive(m,n-1)); 7 } 8 int main() 9... 阅读全文
posted @ 2019-03-07 21:49 念文丶 阅读(266) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 int recursive(int n,int m) 3 { 4 if(m==1||n==1)return 1; 5 else return recursive(n-1,m)+recursive(n,m-1); 6 } 7 int main() 8 { 9 int a,b;//直接上代码,看不懂请刨坑自埋。 10 whi... 阅读全文
posted @ 2019-03-07 21:46 念文丶 阅读(269) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 int recursive(int n,int m) 3 { 4 if(m==0)return 1; 5 else if(n==1)return 1; 6 else if(m==n)return 1; 7 else return recursive(n-1,m-1)+recursive(n-1,m); 8 } 9 int... 阅读全文
posted @ 2019-03-07 21:36 念文丶 阅读(369) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 int main() 3 { 4 int n,m,c,b,i,j; 5 scanf("%d %d %d %d",&n,&m,&c,&b); 6 int a[20][20]= {0},t[20][20]= {0};//t作为标记数组,来标记这点是否可以通过。 7 t[c][b]=1;//现将马所在的点标记为不可通过。 8 ... 阅读全文
posted @ 2019-03-07 21:28 念文丶 阅读(303) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 int main() 4 { 5 int n,sum,i; 6 while(scanf("%d",&n)!=EOF&&n!=0) 7 { 8 sum=1; 9 for(i=1; i<n; i++) 10 { 11 sum=sum*2... 阅读全文
posted @ 2019-03-07 16:31 念文丶 阅读(186) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 int main() 4 { 5 int T,b,i; 6 double a,sum; 7 scanf("%d",&T); 8 while(T--) 9 { 10 scanf("%lf %d",&a,&b); 11 sum=a; 12 a=... 阅读全文
posted @ 2019-03-07 16:28 念文丶 阅读(952) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 int main() 4 { 5 int n,i; 6 long long int a[50]; 7 a[1]=0,a[2]=1;//典型的错排公式。 8 while(scanf("%d",&n)!=EOF) 9 { 10 for(i=3;i<=n;i++) 11 ... 阅读全文
posted @ 2019-03-07 11:45 念文丶 阅读(203) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 int main() 4 { 5 int n,i; 6 long long int a[50]; 7 a[0]=1;a[1]=2; 8 while(scanf("%d",&n)!=EOF) 9 { 10 for(i=2;i<n;i++) 11 { 12 ... 阅读全文
posted @ 2019-03-07 11:21 念文丶 阅读(241) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 int main() 4 { 5 int n,i; 6 long long int a[50]; 7 a[0]=1;a[1]=2; 8 while(scanf("%d",&n)!=EOF) 9 { 10 for(i=2;i<n;i++) 11 { 12 ... 阅读全文
posted @ 2019-03-07 11:20 念文丶 阅读(172) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 int main() 4 { 5 int n,i; 6 int a[20]; 7 a[1]=8,a[0]=5; 8 while(scanf("%d",&n)!=EOF) 9 { 10 for(i=2; i<n; i++) 11 { 12 ... 阅读全文
posted @ 2019-03-06 20:48 念文丶 阅读(260) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 int main() 4 { 5 int n,i; 6 int a[100]; 7 a[3]=4,a[2]=3,a[1]=2;a[0]=1; 8 while(scanf("%d",&n)&&n!=0) 9 { 10 for(i=4; i<n; i++) 11 ... 阅读全文
posted @ 2019-03-06 20:42 念文丶 阅读(273) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 struct node 4 { 5 int data; 6 struct node*next; 7 }; 8 int main() 9 { 10 int m,n,x,i,j; 11 while(~ scanf("%d",&n)&&n!=0) 12 { 13 struct ... 阅读全文
posted @ 2019-03-06 19:42 念文丶 阅读(401) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 struct node 4 { 5 int data; 6 struct node*next; 7 }; 8 int main() 9 { 10 int m,n,x,i,j; 11 struct node*head,*p,*end; 12 head=(struct node*)mallo... 阅读全文
posted @ 2019-03-06 19:30 念文丶 阅读(337) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 struct node 4 { 5 int data; 6 struct node*next,*last; 7 }; 8 int main() 9 { 10 int m,n,x,i,a; 11 struct node*head,*p,*end; 12 head=(struct node*... 阅读全文
posted @ 2019-03-06 18:59 念文丶 阅读(311) 评论(0) 推荐(0) 编辑
摘要: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 scanf("%d",&n); 12 int count=n; 13 struct node*head,*p... 阅读全文
posted @ 2019-03-04 21:30 念文丶 阅读(309) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示