Codeforces round #254 (div2)

Source: Internet
Author: User

Interesting questions. It is very easy to think of, and it is troublesome to think of it.

It is actually a reverse thinking: the final result must be like this:

Wbwbwbwb...

Bwbwbwbw...

Wbwbwbwb...

...

Change "-".

But I started to think about how to handle each vertex. It also depends on the status of the vertex around it. The more I think about it, the more troublesome it is...

The positive and difficult reverse thinking embodied in this question is worth learning.

#include<iostream>#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<map>#include<set>#include<vector>#include<algorithm>#include<stack>#include<queue>using namespace std;#define INF 1000000000#define eps 1e-8#define pii pair<int,int>#define LL long long intint n,m;char mp[105][105];int main(){    //freopen("in1.txt","r",stdin);    //freopen("out.txt","w",stdout);    scanf("%d%d",&n,&m);    getchar();    for(int i=1; i<=n; i++)    {        for(int j=1; j<=m; j++)        {            scanf("%c",&mp[i][j]);        }        getchar();    }    for(int i=1;i<=n;i++)    {        for(int j=1;j<=m;j++)        {            if(mp[i][j]==‘-‘)            {                printf("-");            }            else            {                if((i+j)&1)                {                    printf("B");                }                else                    printf("W");            }        }        printf("\n");    }    //fclose(stdin);    //fclose(stdout);    return 0;}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.