Advertisement
Josif_tepe

Untitled

May 11th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3. #include <cmath>
  4. #include <algorithm>
  5. using namespace std;
  6. int main() {
  7.     int n, m;
  8.     cin >> n >> m;
  9.     char mat[n + 1][m + 1];
  10.     int si, sj;
  11.     for(int i = 0; i < n; i++) {
  12.         for(int j = 0; j < m; j++) {
  13.             cin >> mat[i][j];
  14.             if(mat[i][j] == 'P') {
  15.                 si = i;
  16.                 sj = j;
  17.             }
  18.         }
  19.     }
  20.     queue<int> q;
  21.     q.push(si); // indeks na red
  22.     q.push(sj); // indeks na kolona
  23.     q.push(0);  // broj na cekori
  24.     q.push(1); // dali ke se dzizam 1, 2 ili 3 cekori
  25.    
  26.     int di1[] = {-1, 1, 0, 0};
  27.     int dj1[] = {0, 0, -1, 1};
  28.    
  29.     int di2[] = {-2, 2, 0, 0};
  30.     int dj2[] = {0, 0, -2, 2};
  31.    
  32.     int di3[] = {-3, 3, 0, 0};
  33.     int dj3[] = {0, 0, -3, 3};
  34.    
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement