Comments

Friday, January 25, 2013

Just a Test with Windows Live Writer

Posted by at Friday, January 25, 2013 Read our previous post
20040510-vim_syntax_light_bg

   1:  #include <iostream>
   2:  #define N 4
   3:  using namespace std;
   4:   
   5:  int min(int a,int b){
   6:      if(a < b) return a;
   7:      return b;
   8:  }
   9:  int main(){
  10:      int D[N][N] ={
  11:      {0,999,3,999},
  12:      {2,0,999,999},
  13:      {999,7,0,1},
  14:      {6,999,999,0}
  15:      };
  16:      for(int k = 0; k<N; k++)
  17:          for(int i = 0; i<N; i++)
  18:                for(int j = 0; j<N; j++)
  19:                      D[i][j] = min(D[i][j], D[i][k]+D[k][j]);
  20:                      
  21:      cout<<"\nMatrica udaljenosti:\n";
  22:      for(int i=0;i<N;i++){
  23:          for(int j=0;j<N;j++) 
  24:              cout<<D[i][j]<<" ";
  25:              cout<<"\n";
  26:      }
  27:      int n; cin >> n;
  28:      return 0;
  29:  }

No comments:

Post a Comment

[#] iNFO [#]

All the information provided on this site is for educational purposes only.
 
The site and it's author is in no way responsible for any misuse of the information.
©2012 Security is just an Illusion is powered by Blogger - Template designed by Stramaxon - Best SEO Template