/*
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27454#problem/C
C - Emag eht htiw Em Pleh
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit
Status
Practice
POJ 2993
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.|
+---+---+---+---+---+---+---+---+
Memory Time Language Length Submit Time
Accepted 216 KB 0 ms C++ 1484 B
解析:
1.题意:给出黑白棋子的位置,画出棋盘布局
2.思路:把棋盘分成64大格,用一个结构体标记黑白棋子所在位置。然后输出即可
*/
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27454#problem/C
C - Emag eht htiw Em Pleh
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit
Status
Practice
POJ 2993
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.|
+---+---+---+---+---+---+---+---+
Memory Time Language Length Submit Time
Accepted 216 KB 0 ms C++ 1484 B
解析:
1.题意:给出黑白棋子的位置,画出棋盘布局
2.思路:把棋盘分成64大格,用一个结构体标记黑白棋子所在位置。然后输出即可
*/
#include<stdio.h>
#include<string.h>
#include <iostream>
using namespace std;
char ch[2][200];
char s1[40]="+---+---+---+---+---+---+---+---+";
struct point
{ char le;
int flag;
int sign;
}p[70][70];
int main()
{
int i,j,k,t1,t2;
char s[2][10],st;
for(i=0;i<2;i++)
{cin>>s[i]>>ch[i];}
for(k=0;k<2;k++)
for(i=0;i<strlen(ch[k])-1;i++)
{ st=ch[k][i];
if(st!=',')
{
if(st<='Z'&&st>='A')
{ t1=ch[k][i+1]-'a';
t2=ch[k][i+2]-'0';
p[t2][t1].le=ch[k][i];
i+=3;
}
else
{ t1=ch[k][i]-'a';
t2=ch[k][i+1]-'0';
p[t2][t1].le='P';
i+=2;
}
p[t2][t1].flag=1;
if(k==1)
p[t2][t1].sign=1;
}
}
for(i=8;i>=1;i--)
{ int c=i%2;
printf("%s\n",s1);
for(j=0;j<30;j+=4)
{printf("|");
k=j/4;
if(k%2!=c)
{
if(p[i][k].flag==1)
{
if(p[i][k].sign==1)
printf(":%c:",p[i][k].le+32);
else
printf(":%c:",p[i][k].le);
}
else
printf(":::");
}
else//白子
{
if(p[i][k].flag==1)
{if(p[i][k].sign==0)
printf(".%c.",p[i][k].le);
else
printf(".%c.",p[i][k].le+32);
}
else
printf("...");
}
}
printf("|\n");
}
printf("%s\n",s1);
return 0;
}