-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindSquare.cpp
48 lines (33 loc) · 883 Bytes
/
findSquare.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
#include <iostream>
using namespace std;
/* http://codeforces.com/problemset/problem/1028/A
* A. Find Square
*/
int r, c;
int main(){
cin >> r >> c;
char temp;
int posBr =-1, posBc, l=0;
for(int i =0; i <r; i++){
for(int j =0; j<c; j++){
cin >> temp;
if(temp == 'B'){
if(posBr == -1){
posBr = i;
posBc =j;
}
l++;
if(j + 1 == c){
int temp = l/2;
cout << (posBr + temp + 1) << " " << (posBc + temp +1) <<endl;
return 0;
}
}else if(posBr >-1 ){
int temp = l/2;
cout << (posBr + temp + 1) << " " << (posBc + temp +1) << endl;
return 0;
}
}
}
return 0;
}