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.
View Code
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
相关文章推荐
- mysql 笔记 查询时分秒做条件
- 混淆与反编译
- @ResponseBody 的注解应用
- java io重定向
- zatree for zabbix-2.4.6
- 百度第二大广告代理商来新三板了, 前五大客户都治不孕不育
- YUV格式分析
- POI获取Excel中单元格内容时,如果为数字格式获取类型为double的问题
- TCP/IP
- JIURL文档-Linux的虚拟内存与分页机制(x86-64位)(二)
- 堆栈方向以及大小端存储
- hdu 5538 House Building(水)
- java开发 笔记
- php环境搭建(转载)
- 如何使用Android Studio把自己的Android library分发到jCenter和Maven Central
- Ubuntu下配置支持Windows访问的Samba共享
- No result defined for action org.album.web.PhotoAction and result input
- iOS数据持久化,写入,归档和反归档
- 判断是否夏令时
- java synchronized详解