Advertisement
Pit_Anonim

N

Nov 25th, 2021
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     int size;
  8.     cin>>size;
  9.     int matrix[size][size];
  10.  
  11.     for (int x = 0; x < size; x++)
  12.         for (int y = 0; y < size; y++) {
  13.             cin>>matrix[x][y];
  14.         }
  15.  
  16.     int g = 0;
  17.     int j = 0;
  18.     for (int x = 0; x < size; x++) {
  19.         for (int y = 0; y < size; y++) {
  20.             if (matrix[x][y]) {
  21.                 g++;
  22.             }
  23.         }
  24.  
  25.         for (int u = 0; u < size; u++) {
  26.             if (matrix[u][x]) {
  27.                 j++;
  28.             }
  29.         }
  30.  
  31.         cout<<j<<endl<<g<<endl;
  32.         g=0;
  33.         j=0;
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement