POJ 3311 Hie with the Pie -- TSP 状态压缩dp

/*
	http://poj.org/problem?id=3311 Hie with the Pie
	旅行商问题,状态压缩的dp
*/
#include 
#include 
#include 
#include 
#include 
#include 
using namespace std;
#define CLR(c,v) memset(c,v,sizeof(c))

template 
_T Max(_T a, _T b){
	return (a>b)?(a):(b);
}
template 
_T Max(_T a, _T b,_T c){
	return (a>Max(b,c))?(a):(Max(b,c));
}

const int inf  = -(1<<30);
const int INF  =  (1<<30);
const int M    =  12;

int d[M][M];
int dp[(1< d[i][k] + d[k][j])
					d[i][j] = d[i][k] + d[k][j];
}

int main(){
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int n;
	while(cin >> n,n){
		for(int i = 0; i <= n ; i++){
			for(int j = 0; j <= n ; j++){
				cin >> d[i][j]; // stand for distance[i->j]:d[i][j]
			}
		}
		floyd(n);
 		int bound = (1<

你可能感兴趣的:(【动态规划】,【图论】)