daily pastebin goal
3%
SHARE
TWEET

First positive element in cow

Infiniti_Inter Dec 16th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int n;
  7.  
  8. }
  9. int main()
  10. {
  11.     cin >> n;
  12.     int** a = new int* [n];
  13.     for (int i = 0; i < n; ++i)
  14.         a[i] = new int[n];
  15.     for (int i = 0; i < n; ++i)
  16.         for (int j = 0; j < n; ++j)
  17.             cin >> a[i][j];
  18.    int* b = new int[n];
  19.    int k = 0;
  20.    for (int j = 0; j < n; ++j)
  21.     for (int i = 0; i < n; ++i)
  22.         if (a[i][j] > 0)
  23.             {
  24.                 b[k++] = i + 1;
  25.                 break;
  26.             }
  27.     for (int i = 0; i < n; ++i)
  28.         cout << b[i] << ' ';
  29. }
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