Th3NiKo

Osobistosc

Apr 6th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     short int ile;
  8.     cin >> ile;
  9.     for(short int i = 0; i < ile; i++){
  10.         short int n;
  11.         cin >> n;
  12.         short int tablica[n][n];
  13.         for(short int k = 0; k < n; k++){
  14.             for(short int j = 0; j < n; j++){
  15.                 cin >> tablica[j][k];
  16.             }
  17.         }
  18.  
  19.         short int kolumna = 0;
  20.         short int wiersz = 0;
  21.         while(kolumna < n){
  22.             if(tablica[wiersz][kolumna] == 1){
  23.                 kolumna++;
  24.             } else {
  25.                 wiersz++;
  26.             }
  27.         }
  28.         cout << wiersz + 1 << endl;
  29.  
  30.  
  31.  
  32.     }
  33.  
  34.  
  35.  
  36.     return 0;
  37. }
Add Comment
Please, Sign In to add comment