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. WCF入门 (14)

    前言 上周去面试,跪了,这一年没什么长进,还是挺惭愧的. 得到的评语是:想的太多,做的太少. 做了一份面试题,最后一题是数据库的,写个查询.要查出Score有两次及两次以上超过79的Name和他的最高 ...

  2. MOTT的学习(一)

    MQTT的消息体 flag 此标志设置时,客户端或服务器尝试重新publish,PUBREL,subcribe或unsubscribe消息.这适用于消息, 其中的QoS的值大于零(0),并且需要确认. ...

  3. java.lang.NoClassDefFoundError: com/sun/mail/util/BEncoderStream

    :java.lang.NoClassDefFoundError: com/sun/mail/util/BEncoderStream 这个问题是Mail.jar包没有引入到java路径中,或者是版本的问 ...

  4. .NET Core 在Visual Studio 2015 下的使用-MSDN

    .NET Core RC2 现已推出,这是真正的"候选发布"而非 RC1 Beta 冒充的候选发布(如果是那样,请考虑发布后出现的所有更改).当前,围绕 .NET Core 的开发 ...

  5. 泛——复习js高级第三版

    1:本地存储的几种方法: (1)cookie: (2)localStorage //园子的自动保存就用了本地存储 (3)sessionStorage (4)globalStorage (5)index ...

  6. Html-Css-设置DIV边框圆滑

    border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; -o-border-radius: 10px; ...

  7. DLUTOJ 1209 字典序和r-子集

    传送门 Time Limit: 6 Sec  Memory Limit: 128 MBSubmit: 73  Solved: 14 Description Input 多组输入数据. 每组数据: 第一 ...

  8. IOC 构造函数注入vs属性注入

    1.不管是构造函数注入还是属性注入,都要先把对象给new 出来,构造函数应该也是public.2.一般使用 配置文件,属性注入,不用使用特性,直接配置,初始化或依赖,凡是注入的,都要有访问权限,pub ...

  9. js 对象方法、类方法、原型方法的区别;私有属性、公有属性、公有静态属性的区别

    <html> <head> <meta http-equiv="Content-Type" content="text/html; char ...

  10. 突破XSS字符数量限制执行任意JS代码

    一.综述 有些XSS漏洞由于字符数量有限制而没法有效的利用,只能弹出一个对话框来YY,本文主要讨论如何突破字符数量的限制进行有效的利用,这里对有效利用的定义是可以不受限制执行任意JS.对于跨站师们来说 ...