Advertisement
leminhkt

noname51

Apr 30th, 2020
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.38 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2.  
  3.  
  4.  
  5. using namespace std;
  6.  
  7.  
  8.  
  9. #define f first
  10. #define s second
  11. #define ll long long
  12. #define vi vector<int>
  13. #define vvi vector<vi>
  14.  
  15.  
  16. #define FORn(i, n) for(ll i = 1; i <= (n); i++)
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.         /* ----------------- ~~~~~~~ ----------------- */
  25.  
  26.     int res = 0;
  27.     string Res;
  28.     vector<string> a(10);
  29.     vvi d(10, vi(10));
  30.     void prc(int r, int c, int y, int x, int n = 0){
  31.         if(a[r + y][c + x] == 'W')
  32.             prc(r + y, c + x, y, x, n + 1);
  33.         else if(a[r + y][c + x] == '.'){
  34.             d[r + y][c + x] += n;
  35.             if(d[r + y][c + x] > res)
  36.                 res = d[r + y][c + x],
  37.                 Res = string(1, c + x - 1 + 'a') + string(1, r + y + '0');
  38.         }
  39.         // getch();
  40.     }
  41.  
  42.  
  43.  
  44.  
  45. /* ----------------- ~~~~~~~ ----------------- */
  46.  
  47. int main(){
  48.    
  49.     //freopen("INPUT.inp", "r", stdin);
  50.     //freopen("OUTPUT.out", "w", stdout);
  51.     //ios_base::sync_with_stdio(0); cin.tie(0);
  52.  
  53.         /* ----------------- main func ----------------- */
  54.     a[0] = a[9] = "          ";
  55.     FORn(i, 8){
  56.         cin >> a[i];
  57.         a[i] = " " + a[i] + " ";
  58.     }
  59.     FORn(i, 8)
  60.         FORn(j, 8)
  61.             if(a[i][j] == 'B'){
  62.                 prc(i, j, -1, -1);
  63.                 prc(i, j, -1, 0);
  64.                 prc(i, j, -1, 1);
  65.                 prc(i, j, 0, -1);
  66.                 prc(i, j, 0, 1);
  67.                 prc(i, j, 1, -1);
  68.                 prc(i, j, 1, 0);
  69.                 prc(i, j, 1, 1);
  70.             }
  71.     cout << Res << ' ' << res;
  72.  
  73.  
  74.  
  75.  
  76. /* ----------------- ~~~~~~~~~ ----------------- */
  77.  
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement