-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathassignment1.cpp
More file actions
34 lines (32 loc) · 770 Bytes
/
assignment1.cpp
File metadata and controls
34 lines (32 loc) · 770 Bytes
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
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
cin>>n>>m;
char arr[n][m];
for (int i=0;i<n;i++){
for(int j=0;j<m;j++){
char s;
cin>>s;
arr[i][j]=s;
}
}
int ch=0;
for (int y=0;y<n;y++){
int ch1=0;
for(int z=0;z<m;z++){
if(arr[y][z]=='B'){
++ch;
}
if(ch>0 && arr[y][z]=='W'){
ch1--;
}
ch1++;
}if (ch!=0){
int w=((ch+1)/2);
cout<<y+w<<" "<<ch1+w-ch;
break;
}
}
return 0;
}