您的位置:首页 > 其它

CodeForces 7A - Kalevitch and Chess

2015-08-26 23:26 351 查看
数学题,计算画几次能画出要求的图形。
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <algorithm>
#include <cctype>
#include <stack>
#include <queue>
#include <string>
#include <cstring>
#include <iomanip>
#include <set>
#include <vector>
#include <cstdio>
#include <stack>
#include <sstream>
#include <cstring>
#include <map>
using namespace std;
char arr[9][9];
int main()
{
for(int i=0;i<8;++i)
{
for(int j=0;j<8;++j)
{
cin>>arr[i][j];
}
}
int res1=0;
for(int j=0;j<8;j++)
{
if(arr[0][j]=='B')
{
int cnt=0;
for(int k=1;k<8;k++)
{
if(arr[k][j]=='B')
cnt++;
if(cnt==7)
res1++;
}
}
}
int res2=0;
for(int i=0;i<8;i++)
{
if(arr[i][0]=='B')
{
int cnt=0;
for(int k=1;k<8;++k)
{
if(arr[i][k]=='B')
cnt++;
if(cnt==7)
res2++;
}
}
}
if(res1+res2==16)
cout<<"8"<<endl;
else
cout<<res1+res2<<endl;
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  codeforces math