zoukankan      html  css  js  c++  java
  • Emag eht htiw Em Pleh 分类: POJ 2015-06-29 18:54 10人阅读 评论(0) 收藏

    Emag eht htiw Em Pleh
    Time Limit: 1000MS   Memory Limit: 65536K
    Total Submissions: 2937   Accepted: 1944

    Description

    This problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input.

    Input

    according to output of problem 2996.

    Output

    according to input of problem 2996.

    Sample Input

    White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4
    Black: Ke8,Qd8,Ra8,Rh8,Bc8,Ng8,Nc6,a7,b7,c7,d7,e7,f7,h7,h6

    Sample Output

    +---+---+---+---+---+---+---+---+
    |.r.|:::|.b.|:q:|.k.|:::|.n.|:r:|
    +---+---+---+---+---+---+---+---+
    |:p:|.p.|:p:|.p.|:p:|.p.|:::|.p.|
    +---+---+---+---+---+---+---+---+
    |...|:::|.n.|:::|...|:::|...|:p:|
    +---+---+---+---+---+---+---+---+
    |:::|...|:::|...|:::|...|:::|...|
    +---+---+---+---+---+---+---+---+
    |...|:::|...|:::|.P.|:::|...|:::|
    +---+---+---+---+---+---+---+---+
    |:P:|...|:::|...|:::|...|:::|...|
    +---+---+---+---+---+---+---+---+
    |.P.|:::|.P.|:P:|...|:P:|.P.|:P:|
    +---+---+---+---+---+---+---+---+
    |:R:|.N.|:B:|.Q.|:K:|.B.|:::|.R.|
    +---+---+---+---+---+---+---+---+
    还是模拟题
    
    #include <iostream>
    #include <cstring>
    #include <cstdio>
    #include <cmath>
    #include <string>
    #include <stack>
    #include <queue>
    #include <vector>
    #include <algorithm>
    using namespace std;
    
    const int Max=1100000;
    
    char str[]="+---+---+---+---+---+---+---+---+";
    char s1[]="|:::|...|:::|...|:::|...|:::|...|";
    char s2[]="|...|:::|...|:::|...|:::|...|:::|";
    char Map[55][55];
    void Trans(char s[])
    {
        bool flag=false;
        if(s[0]=='B')
        {
            flag=true;
        }
        for(int i=7; s[i];)
        {
            if(s[i]>='A'&&s[i]<='Z')
            {
                int u=s[i+1]-'a'+1;
                int v=s[i+2]-'0';
                if(flag)
                {
                    Map[v][u]=s[i]+32;
                }
                else
                {
                    Map[v][u]=s[i];
                }
                i+=4;
            }
            else if(s[i]>='a'&&s[i]<='z')
            {
                int u=s[i]-'a'+1;
                int v=s[i+1]-'0';
                if(flag)
                {
                    Map[v][u]='p';
                }
                else
                {
                    Map[v][u]='P';
                }
                i+=3;
            }
        }
    }
    int main()
    {
        char white[110];
        char black[110];
        memset(white,'',sizeof(white));
        memset(black,'',sizeof(black));
        gets(white);
        gets(black);
        memset(Map,0,sizeof(Map));
        Trans(white);
        Trans(black);
        int u=8;
        for(int i=17; i>=1; i--)
        {
            if(i%2)
            {
                printf("%s
    ",str);
            }
            else
            {
                int ans=2;
                int v=1;
                if((i/2)%2)
                {
                    for(int j=0; j<33; j++)
                    {
                        if(j!=ans)
                        {
                            printf("%c",s1[j]);
                        }
                        else
                        {
                            if(Map[u][v])
                            {
                                printf("%c",Map[u][v]);
                            }
                            else
                            {
                                printf("%c",s1[j]);
                            }
                            v++;
                            ans+=4;
                        }
                    }
                }
                else
                {
                    for(int j=0; j<33; j++)
                    {
                        if(j!=ans)
                        {
                            printf("%c",s2[j]);
                        }
                        else
                        {
                            if(Map[u][v])
                            {
                                printf("%c",Map[u][v]);
                            }
                            else
                            {
                                printf("%c",s2[j]);
                            }
                            v++;
                            ans+=4;
                        }
                    }
                }
                printf("
    ");
                u--;
            }
        }
        return 0;
    }
    


    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    递归运用实例
    动手动脑(&课后实验):生成随机数,函数的重载
    求一个数字的每位上的数字并求和
    要求根据RandomStr.java:使用类型转换生成六位验证字符串,示例程序每次运 行时,都会生成不同的字符串。
    Java语言基础问题
    从命令行接收多个数字,求和输出结果
    《大道至简》第一章读后感Java伪代码
    《大道至简》读后感
    怎样关闭WIN7系统的自动更新
    Mongodb集群搭建的三种方式
  • 原文地址:https://www.cnblogs.com/juechen/p/4721968.html
Copyright © 2011-2022 走看看