Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8.     int n;
  9.     cin >> n;
  10.     int **a = new int *[n];
  11.     for (int i = 0; i < n; i++) {
  12.         a[i] = new int [n];
  13.     }
  14.     for (int i = 0; i < n; i++) {
  15.         for (int j = 0; j < n; j++) {
  16.             cin >> a[i][j];
  17.         }
  18.     }
  19.     int *cur = new int [n];
  20.     for (int j = 0; j < n; j++) {
  21.         for (int i = 0; i < n; i++) {
  22.             if (a[i][j] == a[i + 1][j]) {
  23.                 cur[j] = i;
  24.                 break;
  25.             }
  26.         }
  27.     }
  28.     for (int i = 0; i < n; i++) {
  29.         cout << cur[i] << " ";
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement