G2A Many GEOs
SHARE
TWEET

Untitled

a guest Apr 9th, 2020 128 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int main()
  2. {
  3.   ifstream in("in.txt");
  4.   ofstream out("out.txt");
  5.  
  6.   int i;
  7.   in >> i;
  8.  
  9.   vector<vector<double>> matrix(i, vector<double>(i, 0));
  10.   int a, b;
  11.   double w;
  12.  
  13.   while (in >> a >> b >> w)
  14.     {
  15.       matrix[a-1][b-1] = w;
  16.     }
  17.  
  18.   out << fixed << setprecision(1);
  19.   for (int x = 0; x < matrix.size(); x++)
  20.     {
  21.       for (int y = 0; y < matrix.size(); y++)
  22.     out << matrix[x][y] << '\t';
  23.       out << endl;
  24.     }
  25.  
  26.   marks.assign(i, false);
  27.   dfs(0, matrix);
  28.  
  29.   for (int z = 0; z < marks.size(); z++)
  30.     out << marks[z] << '\t';
  31.   out << endl;
  32.  
  33.   // Нерабочий код
  34.   /*
  35.   marks.assign(i, false);
  36.   bfs(0, matrix);
  37.  
  38.   for (int z = 0; z < marks.size(); z++)
  39.     out << marks[z] << '\t';
  40.   out << endl;
  41.   */  
  42.   return 0;
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top