AIM Tech Round 5 (rated, Div. 1 + Div. 2) A Find Square

Posted awcxv

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AIM Tech Round 5 (rated, Div. 1 + Div. 2) A Find Square相关的知识,希望对你有一定的参考价值。

【链接】 我是链接,点我呀:)
【题意】


在这里输入题意

【题解】


找到左上角。往下一直走,往右一直走走到B边界就好。
中点的话。直接输出中位数

【代码】

#include <bits/stdc++.h>
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define lson l,mid,rt<<1
#define ri(x) scanf("%d",&x)
#define rl(x) scanf("%lld",&x)
#define rs(x) scanf("%s",x)
#define rson mid+1,r,rt<<1|1
using namespace std;

const double pi = acos(-1);
const int dx[4] = {0,0,1,-1};
const int dy[4] = {1,-1,0,0};
const int N = 200;

char s[N+10][N+10];
int n,m;

int main(){
    #ifdef LOCAL_DEFINE
        freopen("rush_in.txt", "r", stdin);
    #endif
    ri(n);ri(m);
    rep1(i,1,n)
        rs(s[i]+1);
    rep1(i,1,n){
        rep1(j,1,m)
            if (s[i][j]=='B'){
                int ti = i,tj = j;
                while (ti+1<=n && s[ti+1][j]=='B') ti++;
                while (tj+1<=m && s[i][tj+1]=='B') tj++;
                cout<<(i+ti)/2<<' '<<(j+tj)/2<<endl;
                return 0;
            }
    }
    return 0;
}

以上是关于AIM Tech Round 5 (rated, Div. 1 + Div. 2) A Find Square的主要内容,如果未能解决你的问题,请参考以下文章

AIM Tech Round 5 (rated, Div. 1 + Div. 2) BUnnatural Conditions

AIM Tech Round 5 (rated, Div. 1 + Div. 2) CRectangles

AIM Tech Round 5 (rated, Div. 1 + Div. 2) A Find Square

AIM Tech Round 5 (rated, Div. 1 + Div. 2) 总结题解往前或往后翻,不在这

AIM Tech Round 5 1028cf(A-E)

Codeforces AIM Tech Round3