CodeForces 592A PawnChess
简单暴力模拟。
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; char s[][]; int main()
{
for(int i=;i<;i++) scanf("%s",s[i]);
int A=0x7FFFFFFF,B=0x7FFFFFFF;
for(int i=;i<;i++)
{
for(int j=;j<;j++)
{
if(s[i][j]=='W')
{
bool fail=;
for(int k=i-;k>=;k--)
if(s[k][j]!='.') fail=;
if(fail==) A=min(A,i);
}
}
} for(int i=;i<;i++)
{
for(int j=;j<;j++)
{
if(s[i][j]=='B')
{
bool fail=;
for(int k=i+;k<;k++)
if(s[k][j]!='.') fail=;
if(fail==) B=min(B,-i);
}
}
}
if(A<=B) printf("A\n");
else printf("B\n");
return ;
}
CodeForces 592A PawnChess的更多相关文章
- Codeforces Round #328(Div2)
CodeForces 592A 题意:在8*8棋盘里,有黑白棋,F1选手(W棋往上-->最后至目标点:第1行)先走,F2选手(B棋往下-->最后至目标点:第8行)其次.棋子数不一定相等,F ...
- Codeforces Round #328 (Div. 2) A. PawnChess 暴力
A. PawnChess Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/592/problem/ ...
- Codeforces Round #328 (Div. 2)_A. PawnChess
A. PawnChess time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
- 【Codeforces 738D】Sea Battle(贪心)
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n g ...
- 【Codeforces 738C】Road to Cinema
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants ...
- 【Codeforces 738A】Interview with Oleg
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interv ...
- CodeForces - 662A Gambling Nim
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概 ...
- CodeForces - 274B Zero Tree
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连 ...
随机推荐
- Github-Client(ANDROID)开源之旅(三) ------ 巧用ViewPagerIndicator
接上篇博文:Github-Client(ANDROID)开源之旅(二) ------ 浅析ActionBarSherkLock 文中结合了网易新闻客户端讲解了开源库ActionBarSherklock ...
- 031_spark架构原理
spark核心组件 driver master worker executor task(只有task是线程) 核心组件的原理图解
- NIO入门之轻松读取大文件
NIO入门之轻松读取大文件 今天同事碰到了一个问题,从游戏服务器下载下来的输出log有一个多G大.用记事本打不开,EditPlus也打不开,都提示文件太大.用word也打不开,提示文件大于512M.打 ...
- H3C S5024P交换机 H3C AR28-31路由器命令
H3C S5024P交换机 H3C AR28-31路由器命令 交换机命令 各个视图的切换: 注意命令要在相应的视图下执行 在用户视图下键入quit命令可以断开与交换机的连接.在其它视图中键入quit命 ...
- 10g集群启动顺序
1. 首先, /etc/inittab(不同平台文件名可能不同),文件中的下面3行被调用. h1:35:respawn:/etc/init.d/init.evmd run >/dev/null ...
- hql语法001
1. import java.util.List; import org.hibernate.*; import org.junit.Test; import cn.jbit.hibernatedem ...
- axios 里面 then 默认写的function里面没有this,改成箭头函数后就可以用this了
,methods:{ loadJson:function(){ //this.jsonTest = "jjj" this.$http.get('http://localhost:3 ...
- Hibernate5.x版本HQL限定查询 Legacy-style query parameters (`?`) are no longer supported
在此版本的限定查询和4.0版本的限定查询: 如果查询语句是: String hql = "select u from User u where u.gender = ?"; 会出现 ...
- ZOJ3228 Searching the String (AC自动机)
Searching the String Time Limit: 7 Seconds Memory Limit: 129872 ...
- JavaScript递归简单实现个对象深拷贝
JavaScript中对象的深拷贝来说一直都算比较恶心 毕竟没有什么api能直接全拷贝了 得自己便利写 最近在项目中需要深拷贝 自己简单封了个方法 话不多说 直接上码 <!DOCTYPE ht ...