首页 > 代码库 > 快速切题 poj 2993 Emag eht htiw Em Pleh 模拟

快速切题 poj 2993 Emag eht htiw Em Pleh 模拟

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

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,e4Black: 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<cstdio>#include <cstring>using namespace std;char maz[17][34];int mp[255];char cell[2][3][6]={   {   "+---+",    "|:::|",    "+---+",   },   {    "+---+",    "|...|",    "+---+",    }};void dye(int x,int y){    for(int i=0;i<3;i++){        for(int j=0;j<5;j++){            maz[2*x+i][4*y+j]=cell[(x+y)&1][i][j];        }    }}void clearchess(){    memset(maz,0,sizeof(maz));    for(int i=0;i<8;i++){        for(int j=0;j<8;j++){            dye(i,j);        }    }}char buff[1024];void subinsrt(int x,int y,char ch){    x--;    maz[2*x+1][4*y+2]=ch;}void insrt(bool upc){    int len=strlen(buff);    char use;    for(int i=0;i<len;){        int j;        for( j=i;j<len&&buff[j]!=‘,‘;j++){}        if(j-i==3)use=buff[i];        else use=‘P‘;        if(upc)subinsrt(buff[j-1]-‘0‘,mp[buff[j-2]],use);        else subinsrt(buff[j-1]-‘0‘,mp[buff[j-2]],use-‘A‘+‘a‘);        i=j+1;       // for(int i=0;i<17;i++)puts(maz[i]);    }}int main(){    for(int i=0;i<26;i++)mp[i+‘a‘]=i;    clearchess();    scanf("%s",buff);    scanf("%s",buff);    insrt(true);    scanf("%s",buff);    scanf("%s",buff);    insrt(false);    for(int i=16;i>=0;i--)puts(maz[i]);    return 0;}

  

快速切题 poj 2993 Emag eht htiw Em Pleh 模拟