POJ训练计划3993_Emag eht htiw Em Pleh(模拟)

Emag eht htiw Em Pleh
Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

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 <stdio.h>
#include <string.h>
using namespace std;
char mmap[35][35]={
"+---+---+---+---+---+---+---+---+",
"|...|:::|...|:::|...|:::|...|:::|",
"+---+---+---+---+---+---+---+---+",
"|:::|...|:::|...|:::|...|:::|...|",
"+---+---+---+---+---+---+---+---+",
"|...|:::|...|:::|...|:::|...|:::|",
"+---+---+---+---+---+---+---+---+",
"|:::|...|:::|...|:::|...|:::|...|",
"+---+---+---+---+---+---+---+---+",
"|...|:::|...|:::|...|:::|...|:::|",
"+---+---+---+---+---+---+---+---+",
"|:::|...|:::|...|:::|...|:::|...|",
"+---+---+---+---+---+---+---+---+",
"|...|:::|...|:::|...|:::|...|:::|",
"+---+---+---+---+---+---+---+---+",
"|:::|...|:::|...|:::|...|:::|...|",
"+---+---+---+---+---+---+---+---+",
};
int num[16]= {0,15,13,11,9,7,5,3,1};
int main()
{
    int i,j;
    char s1[1000],str1[1000],s2[1000],str2[1000];
    scanf("%s%s%s%s",s1,str1,s2,str2);
    for(i=0; str1[i]!='\0'; i++)
    {
        if(str1[i]=='K')
        {
            int x=str1[i+2]-'0';
            int y=(str1[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='K';
        }
        if(str1[i]=='Q')
        {
            int x=str1[i+2]-'0';
            int y=(str1[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='Q';
        }
        if(str1[i]=='R')
        {
            int x=str1[i+2]-'0';
            int y=(str1[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='R';
        }
        if(str1[i]=='B')
        {
            int x=str1[i+2]-'0';
            int y=(str1[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='B';
        }
        if(str1[i]=='N')
        {
            int x=str1[i+2]-'0';
            int y=(str1[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='N';
        }
        if(str1[i]==','&&(str1[i+2]>='0'&&str1[i+2]<='9'))
        {
            int x=str1[i+2]-'0';
            int y=(str1[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='P';
        }
    }
    for(i=0; str2[i]!='\0'; i++)
    {
        if(str2[i]=='K')
        {
            int x=str2[i+2]-'0';
            int y=(str2[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='k';
        }
        if(str2[i]=='Q')
        {
            int x=str2[i+2]-'0';
            int y=(str2[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='q';
        }
        if(str2[i]=='R')
        {
            int x=str2[i+2]-'0';
            int y=(str2[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='r';
        }
        if(str2[i]=='B')
        {
            int x=str2[i+2]-'0';
            int y=(str2[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='b';
        }
        if(str2[i]=='N')
        {
            int x=str2[i+2]-'0';
            int y=(str2[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='n';
        }
        if(str2[i]==','&&(str2[i+2]>='0'&&str2[i+2]<='9'))
        {
            int x=str2[i+2]-'0';
            int y=(str2[i+1]-'a'+1)*4-2;
            mmap[num[x]][y]='p';
        }
    }
    for(i=0; i<=16; i++)
        printf("%s\n",mmap[i]);
    return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值