-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy path1028A.cpp
52 lines (45 loc) · 790 Bytes
/
1028A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<bits/stdc++.h>
using namespace std;
void startPos(int *a, int *b, int n, int m, int arr[n][]){
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(arr[i][j] == 'B'){
*a = i;
*b = j;
return;
}
}
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin>>n>>m;
int arr[n][m];
for(int i = 0; i< n; i++){
for(int j = 0; j < m; j++){
cin>>arr[n][m];
}
}
int a, b;
startPos(&a, &b, n, m, &arr);
int a1, b1;
int i = a;
for(i = a; i < n; i++){
if(arr[i][b] == 'W'){
break;
}
}
a1 = i+1;
int j = b;
for(j = b; j < m; j++){
if(arr[a][j] == 'W'){
break;
}
}
b1 = j+1;
a++;
b++;
cout<<((a + a1)/2)<<" "<<((b + b1)/2)<<endl;
}