Fork me on GitHub

随笔分类 -  C

摘要:#include <stdio.h> int Queenes[8]={0},Counts=0; k =0; int Check(int line,int list){ //遍历该行之前的所有行 for (int index=0; index<line; index++) { //挨个取出前面行中皇后 阅读全文
posted @ 2020-11-26 14:57 暗里有光 阅读(134) 评论(0) 推荐(0)
摘要:#include <stdlib.h> #include <stdio.h> #define N 20 void MatrixChain(int p[N],int n,int m[N][N],int s[N][N]){ int i,j,t,k; int r; //记录相乘的矩阵个数变量 for(i= 阅读全文
posted @ 2020-11-12 15:27 暗里有光 阅读(352) 评论(0) 推荐(1)
摘要:#include<stdio.h> void package_part(int *w,int *v,double *p,int n,int c,int *flag) { int i,j,temp; double tempD,totalValue = 0.0; //计算单位 for(i=0;i<n;i 阅读全文
posted @ 2020-11-12 15:15 暗里有光 阅读(305) 评论(1) 推荐(0)
摘要:#include<stdio.h> /* * s[]:活动的开始时间 * f[]:活动的结束时间(非降序排列) * a[]:0或者1,为0表示活动不被安排,1表示活动被安排 * k:活动个数 */ void greedy(int s[],int f[],int a[],int k) { int i; 阅读全文
posted @ 2020-11-12 14:57 暗里有光 阅读(526) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<stdlib.h> int V[100][100];//前i个物品装入容量为j的背包中获得的最大价值 int max(int a,int b){ if(a>=b) return a; else return b; } int KnapSack(i 阅读全文
posted @ 2020-10-29 15:12 暗里有光 阅读(126) 评论(0) 推荐(0)
摘要:1 #include<stdio.h> 2 #define m 10 3 #define n 10 4 int c[m + 1][n + 1]; 5 int b[m+1][n+1]; 6 7 void LCS_LENGTH(char *x,char *y) 8 { 9 int i,j; 10 for 阅读全文
posted @ 2020-10-10 15:26 暗里有光 阅读(176) 评论(0) 推荐(0)

1