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 }
View Code

相关文章:

  • 2021-09-18
  • 2022-02-19
  • 2021-10-11
  • 2021-09-06
  • 2021-05-27
  • 2022-03-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-18
  • 2021-11-07
  • 2021-08-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案