Emag eht htiw Em Pleh
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
大家可以去poj 看看原题
这提题是逆序输出
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cstdlib>
using namespace std;
char s[][];
void print(int t)
{
if(t) printf(".");
else printf(":");
}
int main()
{
int xi,yi,i,j,t;
char str[],ch,x,y;
for(i=; i<; i++)
for(j=; j<; j++)
{
if((i+j)%)
s[i][j]='.';
else s[i][j]=':';
}
for(i=; i<; i++)
{
scanf("%s",str);
if(strcmp(str,"White:")==)
{
while(scanf("%c",&ch)&&ch!='\n')
{
if('A'<=ch&&ch<='Z')
{
scanf("%c%c",&x,&y);
xi=x-'a'+;
yi=y-'';
s[yi][xi]=ch;
}
else if('a'<=ch&&ch<'i')
{
xi=ch-'a'+;
scanf("%c",&y);
yi=y-'';
s[yi][xi]='P';
}
}
}
else
{
while(scanf("%c",&ch)&&ch!='\n')
{
if('A'<=ch&&ch<='Z')
{
scanf("%c%c",&x,&y);
xi=x-'a'+;
yi=y-'';
s[yi][xi]=ch+;
}
else if('a'<=ch&&ch<'i')
{
xi=ch-'a'+;
scanf("%c",&y);
yi=y-'';
s[yi][xi]='p';
}
}
}
}
for(i=; i>; i--)
{
printf("+---+---+---+---+---+---+---+---+\n");
for(j=; j<; j++)
{
printf("|");
t=(i+j)%;
print(t);
printf("%c",s[i][j]);
print(t);
}
printf("|\n");
}
printf("+---+---+---+---+---+---+---+---+\n");
return ;
}