您的位置:首页 > 其它

CF div2 328 A

2015-11-02 10:47 225 查看
A. PawnChess

time limit per test
1 second

memory limit per test
256 megabytes

input
standard input

output
standard output

Galois is one of the strongest chess players of Byteforces. He has even invented a new variant of chess, which he named «PawnChess».

This new game is played on a board consisting of 8 rows and 8 columns. At the beginning of every game some black and white pawns are placed on the board. The number of black pawns placed is not necessarily equal to the number of white pawns placed.

#include <cstdio>
#include <cstring>
#include <iostream>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <vector>

using namespace std;

const int maxn = 1000005;

typedef long long LL;

vector<int>G[maxn];

int a[maxn];
int res[maxn];

char s[10][10];

int vis[10][10];

int main()
{
int n,m;
for(int i=0;i<8;i++){
scanf("%s",s[i]);
}
int ansB = 1000;
int ansA = 1000;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
if(s[i][j] == 'B'){
int step = 0;
for(int k=i+1;k<8;k++){
if(s[k][j] == 'W'){
step = 1000;
break;
}
step ++;
}
ansB = min(step,ansB);
}
if(s[i][j] == 'W'){
int step1 = 0;
for(int k=i-1;k>=0;k--){
if(s[k][j] == 'B'){
step1 = 1000;
break;
}
step1 ++;
}
ansA = min(step1,ansA);
}

}

}
if(ansA <= ansB) printf("A\n");
if(ansA > ansB)printf("B\n");

return 0;
}


View Code
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: