Advertisement
KedrikFeeD

peresdacha

Jan 27th, 2022
1,073
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     const int n = 5;
  6.     int mat[n][n];
  7.     bool math[n];
  8.     int sum = 0, count = 0;
  9.     for (int i = 0; i < n; i++) {
  10.         for (int j = 0; j < n; j++) {
  11.             cin >> mat[i][j];
  12.         }
  13.     }
  14.     for (int j = 0; j < n; j++) {
  15.         for (int i = 0; i < n; i++) {
  16.             for (int k = 1; k <= mat[i][j] / 2; k++) {
  17.                 if (mat[i][j] % k == 0) {
  18.                     sum += k;
  19.                 }
  20.             }
  21.             if (mat[i][j] == sum)
  22.                 count++;
  23.             sum = 0;
  24.         }
  25.         if (count <= 3)
  26.             math[j] = true;
  27.         else
  28.             math[j] = false;
  29.         count = 0;
  30.     }
  31.     for (int i = 0; i < n; i++) {
  32.         for (int j = 0; j < n; j++) {
  33.             cout << mat[i][j] << "\t";
  34.         }
  35.         cout << endl;
  36.     }
  37.     cout << endl;
  38.     for (int i = 0; i < n; i++)
  39.         cout << math[i] << "\t";
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement