poj2993 Flip 2996

Source: Internet
Author: User

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

Description

This problem was a reverse case of the problem 2996. You are given the output of the problem H and your task was 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.| +---+---+---+---+---+---+---+---+

Source

#include <stdio.h>
#include <string.h>
Char map[10][10],str1[100],str2[100];
int main () {
while (gets (str1)) {
Gets (STR2);
int Len1=strlen (STR1);
int Len2=strlen (STR2);
for (int i=0;i<=len1-1;i++) {
if (str1[i]>= ' 1 ' &&str1[i]<= ' 9 ') {
if (str1[i-2]!= ', ')
map[str1[i]-' 1 ' +1][str1[i-1]-' a ' +1]=str1[i-2];
Else
map[str1[i]-' 1 ' +1][str1[i-1]-' a ' +1]= ' P ';
}
}
for (int i=0;i<=len2-1;i++) {
if (str2[i]>= ' 1 ' &&str2[i]<= ' 9 ') {
if (str2[i-2]!= ', ')
map[str2[i]-' 1 ' +1][str2[i-1]-' a ' +1]=str2[i-2]+32;
Else
map[str2[i]-' 1 ' +1][str2[i-1]-' a ' +1]= ' P ';
}
}

printf ("+---+---+---+---+---+---+---+---+\n");
for (int i=8;i>=1;i--) {
printf ("|");
for (int j=1;j<=8;j++) {
if ((i+j)%2==0) {
printf (":");
if (Map[i][j]) printf ("%c", Map[i][j]);
else printf (":");
printf (":");
}
else {
printf (".");
if (Map[i][j]) printf ("%c", Map[i][j]);
else printf (".");
printf (".");
}
printf ("|");
}
printf ("\ n");
printf ("+---+---+---+---+---+---+---+---+\n");
}
memset (str1,0,sizeof (str1));
memset (str2,0,sizeof (str2));
memset (map,0,sizeof (map));
}
return 0;
}

poj2993 Flip 2996

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.