http://codeforces.com/contest/7
A
水题
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define lson l,mid,rt<<1 4 #define rson mid+1,r,rt<<1|1 5 #define sqr(x) ((x)*(x)) 6 #define maxn 1000010 7 typedef long long ll; 8 /*#ifndef ONLINE_JUDGE 9 freopen("1.txt","r",stdin); 10 #endif */ 11 12 string str[15]; 13 int book[15][15]; 14 15 int Check1(int x){//lie 16 for(int i=0;i<8;i++){ 17 if(str[i][x]!='B') return 0; 18 } 19 int ans=0; 20 for(int i=0;i<8;i++){ 21 if(book[i][x]==0) book[i][x]=1,ans=1; 22 } 23 return ans; 24 } 25 26 int Check2(int x){ 27 for(int i=0;i<8;i++){ 28 if(str[x][i]!='B') return 0; 29 } 30 int ans=0; 31 for(int i=0;i<8;i++){ 32 if(book[x][i]==0) book[x][i]=1,ans=1; 33 } 34 return ans; 35 } 36 37 38 int main(){ 39 #ifndef ONLINE_JUDGE 40 freopen("1.txt","r",stdin); 41 #endif 42 std::ios::sync_with_stdio(false); 43 for(int i=0;i<8;i++) cin>>str[i]; 44 int ans=0; 45 for(int i=0;i<8;i++){ 46 ans+=Check1(i); 47 } 48 for(int i=0;i<8;i++){ 49 ans+=Check2(i); 50 } 51 cout<<ans<<endl; 52 }