irapilguy

Untitled

Nov 14th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <queue>
  2. #include <iostream>
  3. using namespace std;
  4. #define N 100
  5. int mas[N][N];
  6. int used[N] = { 0 };
  7. int n;
  8. void bfs(int v) {
  9.     queue<int> q;
  10.     q.push(v);
  11.     used[v] = 1;
  12.     while () {
  13.         for (int i = 1; i <= n; i++) {
  14.             if (used[i] == 0 && mas[v][i] == 1) {
  15.                 q.push(i);
  16.                 used[i] = 1;
  17.             }
  18.         }
  19.     }
  20.  
  21.  
  22. }
Add Comment
Please, Sign In to add comment