摘要:
1.回溯法编程求解0-1背包问题 #include<stdio.h> #include<iostream> using namespace std; int c,n; int cv=0,cw=0,mv=0,mw=0; int weight[20],value[20]; int x[20],bestv 阅读全文
摘要:
1.单源最短路径问题 #include<stdio.h> #include<iostream> #include<cmath> using namespace std; #define M 1000 int Cost[20][20]; int n; int Distance[20]; bool s[ 阅读全文
摘要:
利用动态规划算法编程求解TSP问题 #include<stdio.h> #include<iostream> #include<cmath> using namespace std; #define INF 9000 int mp[20][20]; int n; int dp[20][1<<20]; 阅读全文