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;
}