Advertisement
K_Y_M_bl_C

Untitled

Apr 20th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.12 KB | None | 0 0
  1. #define __zHOPnoe_gettingspeed args-1
  2. #define pIZ_da 543
  3. #define _get_Hуйй вмfe
  4. #define tyxyecoc sasat
  5.  
  6. #include <iostream>
  7. using namespace std;
  8.  
  9. int a[50][50];
  10.  
  11. int main() {
  12.     int n, m;
  13.     cin >> n >> m;
  14.     int BOMBOSXER;
  15.     cin >> BOMBOSXER;
  16.     for (int i = 0; i < BOMBOSXER; ++i)
  17.     {
  18.         int XER, XER2;
  19.         cin >> XER >> XER2;
  20.         --XER, --XER2;
  21.         a[XER][XER2] = -1;
  22.     }
  23.     for (int i = 0; i < n; ++i)
  24.         for (int j = 0; j < m; ++j)
  25.         {
  26.             if (a[i][j] != -1)
  27.             {
  28.                 int SCHITAT_ZHOPY = 0;
  29.                 SCHITAT_ZHOPY += (a[i - 1][j - 1] == -1) ? 1 : 0;
  30.                 SCHITAT_ZHOPY += (a[i - 1][j] == -1) ? 1 : 0;
  31.                 SCHITAT_ZHOPY += (a[i - 1][j + 1] == -1) ? 1 : 0;
  32.                 SCHITAT_ZHOPY += (a[i + 1][j - 1] == -1) ? 1 : 0;
  33.                 SCHITAT_ZHOPY += (a[i + 1][j] == -1) ? 1 : 0;
  34.                 SCHITAT_ZHOPY += (a[i + 1][j + 1] == -1) ? 1 : 0;
  35.                 SCHITAT_ZHOPY += (a[i][j - 1] == -1) ? 1 : 0;
  36.                 SCHITAT_ZHOPY += (a[i][j + 1] == -1) ? 1 : 0;
  37.                 a[i][j] = SCHITAT_ZHOPY;
  38.             }
  39.         }
  40.     for (int i = 0; i < n; ++i)
  41.     {
  42.         for (int j = 0; j < m; ++j)
  43.             if (a[i][j] == -1)
  44.                 cout << "*";
  45.             else
  46.                 cout << a[i][j];
  47.         cout << "\n";
  48.     }
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement