Advertisement
STANAANDREY

sb prog 14

Feb 24th, 2022
849
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("graf.in");
  5. ofstream fout("muchii.txt");
  6. int n, a[51][51];
  7.  
  8. int main() {
  9.     fin >> n;
  10.     for (int i = 1; i <= n; i++) {
  11.         for (int j = 1; j <= n; j++) {
  12.             fin >> a[i][j];
  13.         }
  14.     }
  15.  
  16.     for (int i = 1; i < n; i++) {
  17.         for (int j = i + 1; j <= n; j++) {
  18.             if (a[i][j]) {
  19.                 cout << i << ' ' << j << endl;
  20.             }
  21.         }
  22.     }
  23.  
  24.     return 0;
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement