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

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.|
+---+---+---+---+---+---+---+---+

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 翻转2996的更多相关文章

  1. [LeetCode] Reverse Vowels of a String 翻转字符串中的元音字母

    Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Giv ...

  2. [LeetCode] Reverse String 翻转字符串

    Write a function that takes a string as input and returns the string reversed. Example: Given s = &q ...

  3. [LeetCode] Flip Game 翻转游戏

    You are playing the following Flip Game with your friend: Given a string that contains only these tw ...

  4. [LeetCode] Invert Binary Tree 翻转二叉树

    Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem wa ...

  5. [LeetCode] Reverse Words in a String II 翻转字符串中的单词之二

    Given an input string, reverse the string word by word. A word is defined as a sequence of non-space ...

  6. [LeetCode] Reverse Words in a String 翻转字符串中的单词

    Given an input string, reverse the string word by word. For example, Given s = "the sky is blue ...

  7. [LeetCode] Reverse Nodes in k-Group 每k个一组翻转链表

    Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If ...

  8. [LeetCode] Reverse Integer 翻转整数

    Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to ...

  9. canvas-图片翻转

    图片90度翻转 在canvas中插入图片需先加载图片(利用Image对象);加载完成后再执行操作drawImage(obj,x,y,w,h) 插入图片的坐标宽高等值 <!DOCTYPE html ...

随机推荐

  1. 使用TinkPHP实现品字形布局

    一.后台管理模版 后台管理模版通常使用frameset/iframe来布局.例如: <!DOCTYPE html> <html> <head> <title& ...

  2. js中基本操作

    1.操作标签值 <!DOCTYPE html> <html> <meta charset="utf-8"> <meta http-equi ...

  3. AngularJS-MVC

    前言: 编程是一个很苦恼的工作,因为需要我们不断的去学习,不断的去专研,我本身就不是一个很喜欢学习的孩子,要不然从小到大也没有成绩好过,但是,我从来没有缺少过勤奋,还是让我们言归正传来说下 我们这段时 ...

  4. Excel解析与导入导出

    第三次结对编程作业 结对成员: 031302610黄志鹏 031302603 陈波 功能分析 1.将初始排课表excel导入系统数据库 2.将系统数据库的排课数据显示在web界面 实现思路 一.实现将 ...

  5. 报课系统APP

    031302307黄丰润 031302343张晓燕 #NABCD模型分析 合理分析需求有助于说服客户,所以我们有如下分析 N(need)--客户需要什么 负责人需要将选课信息和选课表格一起发送给所负责 ...

  6. java、java -version 可以javac没有内部命令的问题

    环境变量没有配错的情况下就是path变量的值要放在最前面

  7. '$.browser.msie' 为空或不是对象

    最近决定整改一下jquery 的版本,于是就将 jquery 从 1.7.2 升级到了 1.9.1 结果就发现原有的插件报错了. '$.browser.msie' 为空或不是对象,这个是jQuery错 ...

  8. UTL_FILE详解

    包UTL_FILE 提供了在操作系统层面上对文件系统中文件的读写功能.非超级用户在使用包UTL_FILE中任何函数或存储过程前必须由超级用户授予在这个包上的EXECUTE权限.例如:我们使用下列命令对 ...

  9. BZOJ3732 Network

    Description 给你N个点的无向图 (1 <= N <= 15,000),记为:1…N. 图中有M条边 (1 <= M <= 30,000) ,第j条边的长度为: d_ ...

  10. Codeforces 1C Ancient Berland Circus

    传送门 题意 给出一正多边形三顶点的坐标,求此正多边形的面积最小值. 分析 为了叙述方便,定义正多边形的单位圆心角u为正多边形的某条边对其外接圆的圆心角(即外接圆的某条弦所对的圆心角). (1)多边形 ...