运筹学实验

运筹学实验

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 5078056012 x x 10 x 2 2 [ 15 2 5 x 2 ) 1 ) OPL )5 Bektas (2006)) x 1 2 3 4 5 6 7 8 9 10 1 - 5 8 9 6 8 3 1 2 8 2 6 - 6 2 8 6 1 9 6 4 3 5 6 - 4 6 1 9 6 3 8 4 9 2 5 - 5 2 8 1 2 4 5 7 6 7 3 - 8 2 3 1 7 6 3 8 2 8 7 - 7 3 1 8 7 2 2 4 4 1 8 - 5 9 1 8 7 6 7 7 5 5 5 - 2 6 9 3 4 3 2 7 3 9 6 - 3 10 9 4 9 9 3 7 4 3 5 - x 5 1 ) C ) x z x #include<iostream> using namespace std; const int N = 10000000; int matrix[10][10] = {{0,5,8,9,6,8,3,1,2,8}, {6,0,6,2,8,6,1,9,6,4 }, {5,6,0,4,6,1,9,6,3,8}, {9,2,5,0,5,2,8,1,2,4 }, {7,6,7,3,0,8,2,3,1,7}, {3,8,2,8,7,0,7,3,1,8}, {2,2,4,4,1,8,0,5,9,1}, {7,6,7,7,5,5,5,0,2,6}, {3,4,3,2,7,3,9,6,0,3}, {9,4,9,9,3,7,4,3,5,0} }; int vexnum = 10; int D[10][10]; void Floyd(); int main(void){ int i,j; Floyd(); for(i=0;i<vexnum;i++){ for(j=0;j<vexnum;j++) cout<<"D["<<i+1<<"]["<<j+1<<"]:"<<D[i][j]<<"\t"; cout<<endl; } system("pause"); return 0; } void Floyd(){ int i,j,k; //init for(i=0;i<vexnum;i++) for(j=0;j<vexnum;j++) D[i][j] = matrix[i][j]; for(i=0;i<vexnum;i++) D[i][i] = 0; //Floyd for(i=0;i<vexnum;i++) for(j=0;j<vexnum;j++) for(k=0;k<vexnum;k++){ if(matrix[i][k]==N||matrix[k][j]==N) continue;...
View Full Document

Page1 / 5

运筹学实验

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online