//POJ 2993
#include <stdio.h>
#include <string.h>
#include <iostream>
char mp[40][40];
char s1[40], s2[40];
int main()
{
//打印没有字母的空盘
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 8; j++)
{
mp[2*i][4*j] = '+';
mp[2*i+1][4*j] = '|';
mp[2*i][4*j+1] = '-';
mp[2*i][4*j+2] = '-';
mp[2*i][4*j+3] = '-';
}
mp[2*i][32] = '+';
mp[2*i+1][32] = '|';
mp[2*i][33] = '\0';
mp[2*i+1][33] = '\0';
if(i == 7)
{
for(int j = 0; j < 8; j++)
{
mp[2*i+2][4*j] = '+';
mp[2*i+2][4*j+1]='-';
mp[2*i+2][4*j+2]='-';
mp[2*i+2][4*j+3]='-';
}
mp[2*i+2][32]='+';
mp[2*i+2][33]='\0';
}
for(int j = 0; j < 8; j++)
{
if((i+j)%2 == 0)
{
mp[2*i+1][4*j+1]='.';
mp[2*i+1][4*j+2]='.';
mp[2*i+1][4*j+3]='.';
}
else
{
mp[2*i+1][4*j+1]=':';
mp[2*i+1][4*j+2]=':';
mp[2*i+1][4*j+3]=':';
}
}
}
// for(int i = 0; i < 17; i++)
// {
// for(int j = 0; j < 34; j++)
// {
// printf("%c", mp[i][j]);
// }
// printf("\n");
// }
scanf("%s%s", s1, s2);
for(int i = 0; s2[i] ;){
if(s2[i] == ','){
i++;
continue;
}
if(isupper(s2[i])){
int x = 8 - (s2[i+2]-'0');
int y = s2[i+1] - 'a';
mp[2*x+1][4*y+2] = s2[i];
i += 3;
}
else{
int x = 8 - (s2[i+1]-'0');
int y = s2[i]-'a';
mp[2*x+1][4*y+2] = 'P';
i += 2;
}
}
scanf("%s%s", s1, s2);
for(int i = 0; s2[i] ;){
if(s2[i] == ','){
i++;
continue;
}
if(isupper(s2[i])){
int x = 8 - (s2[i+2]-'0');
int y = s2[i+1] - 'a';
mp[2*x+1][4*y+2] = s2[i] - 'A' + 'a';
i += 3;
}
else{
int x = 8 - (s2[i+1]-'0');
int y = s2[i]-'a';
mp[2*x+1][4*y+2] = 'p';
i += 2;
}
}
for(int i = 0; i < 17; i++) printf("%s\n", mp[i]);
}
POJ 2993 Emag eht htiw Em Pleh 模拟,题意
最新推荐文章于 2021-10-25 16:20:40 发布