Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u

Submit Status

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

题意就是把2996的那道题的输出变输入,输入变输出。我觉得一下子变简单了很多,起码没那么多的麻烦事了。

思路就是现在是一个空棋盘,然后题目给了各个棋子的位置,拿这些棋子去占相应的位置,之后再输出占好各个位置的棋盘。

代码:

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#pragma warning(disable:4996)
using namespace std; const string temp="+---+---+---+---+---+---+---+---+";
string test[20];
string cal[5]; int i,len;
char row,col; int main()
{
test[1]="|...|:::|...|:::|...|:::|...|:::|";
test[2]="|:::|...|:::|...|:::|...|:::|...|";
test[3]="|...|:::|...|:::|...|:::|...|:::|";
test[4]="|:::|...|:::|...|:::|...|:::|...|";
test[5]="|...|:::|...|:::|...|:::|...|:::|";
test[6]="|:::|...|:::|...|:::|...|:::|...|";
test[7]="|...|:::|...|:::|...|:::|...|:::|";
test[8]="|:::|...|:::|...|:::|...|:::|...|"; cin>>cal[0];
cin>>cal[1];
cin>>cal[3];
cin>>cal[2]; len=cal[1].length();
for(i=0;i<len;i++)
{
if(cal[1][i]==',')continue;
else if(cal[1][i]=='K')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='K';
i=i+2;
}
else if(cal[1][i]=='Q')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='Q';
i=i+2;
}
else if(cal[1][i]=='R')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='R';
i=i+2;
}
else if(cal[1][i]=='B')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='B';
i=i+2;
}
else if(cal[1][i]=='N')
{
row=cal[1][i+1];
col=cal[1][i+2]; test[9-(col-'0')][(row-'a')*4+2]='N';
i=i+2;
}
else if(cal[1][i]>='a'&&cal[1][i]<='h')
{
row=cal[1][i];
col=cal[1][i+1]; test[9-(col-'0')][(row-'a')*4+2]='P';
i=i+1;
}
} len=cal[2].length();
for(i=0;i<len;i++)
{
if(cal[2][i]==',')continue;
else if(cal[2][i]=='K')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='k';
i=i+2;
}
else if(cal[2][i]=='Q')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='q';
i=i+2;
}
else if(cal[2][i]=='R')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='r';
i=i+2;
}
else if(cal[2][i]=='B')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='b';
i=i+2;
}
else if(cal[2][i]=='N')
{
row=cal[2][i+1];
col=cal[2][i+2]; test[9-(col-'0')][(row-'a')*4+2]='n';
i=i+2;
}
else if(cal[2][i]>='a'&&cal[2][i]<='h')
{
row=cal[2][i];
col=cal[2][i+1]; test[9-(col-'0')][(row-'a')*4+2]='p';
i=i+1;
}
} cout<<temp<<endl;
for(i=1;i<=8;i++)
{
cout<<test[i]<<endl;
cout<<temp<<endl;
} return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

POJ 2993:Emag eht htiw Em Pleh的更多相关文章

  1. Poj 2993 Emag eht htiw Em Pleh

    1.Link: http://poj.org/problem?id=2993 2.Content: Emag eht htiw Em Pleh Time Limit: 1000MS   Memory ...

  2. 模拟 POJ 2993 Emag eht htiw Em Pleh

    题目地址:http://poj.org/problem?id=2993 /* 题意:与POJ2996完全相反 模拟题 + 字符串处理:无算法,读入两行字符串找出相应点用used标记,输出时标记过的输出 ...

  3. POJ 2993 Emag eht htiw Em Pleh【模拟画棋盘】

    链接: http://poj.org/problem?id=2993 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27454#probl ...

  4. Emag eht htiw Em Pleh 分类: POJ 2015-06-29 18:54 10人阅读 评论(0) 收藏

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

  5. 快速切题 poj 2993 Emag eht htiw Em Pleh 模拟 难度:0

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

  6. POJ2993——Emag eht htiw Em Pleh(字符串处理+排序)

    Emag eht htiw Em Pleh DescriptionThis problem is a reverse case of the problem 2996. You are given t ...

  7. Emag eht htiw Em Pleh

    Emag eht htiw Em Pleh This problem is a reverse case of the problem 2996. You are given the output o ...

  8. Emag eht htiw Em Pleh(imitate)

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

  9. 模拟 + 打表 --- Emag eht htiw Em Pleh

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

随机推荐

  1. 5G/NR OTA (Over The Air) 测试详解

    原文链接:http://www.sharetechnote.com/html/5G/5G_OTA.html 1 什么是OTA (Over The Air) OTA代表Over The Air.为了使用 ...

  2. CentOS下安装Orcale

    以前没有安装过,最近安装了.感觉在Liunx安装真的超麻烦.这是技术文档,分享给大家. LINUX安装oracle数据库步骤: 1.安装依赖包    yum -y install  gcc gcc-c ...

  3. 基于LAMP实现后台活动发布和前端扫码签到系统

    目的 无论是公司.学校和社会团体,都会举办各式各样的活动,比如运动会.部门会议.项目会议.野炊.团建等.作为团队管理者来讲,当然希望能够把这类活动转移到线上形成完整的系统,类似于电子流的形式.本文以学 ...

  4. android中的简单animation(三)accelerate(加速),decelerate(减速),anticipate,overshoot,bounce

    animation_3.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout x ...

  5. java随机函数用法Random

     原文地址:http://blog.csdn.net/wpjava/article/details/6004492  import java.util.Random; public class Ran ...

  6. 028、Java中的关系运算符

    01.代码如下: package TIANPAN; /** * 此处为文档注释 * * @author 田攀 微信382477247 */ public class TestDemo { public ...

  7. 009-PHP循环输出数组成员

    <?php $Cities[] = "<B>北京</B>"; //等同于$Cities[0] = "北京" $Cities[] = ...

  8. centos7创建ssh公钥

    步骤1:使用ssh-keygen命令创建公钥和私钥 [root@model /]# [root@model /]# ssh-keygen -t rsa -P '' Generating public/ ...

  9. Java 类的属性

    章节 Java 基础 Java 简介 Java 环境搭建 Java 基本语法 Java 注释 Java 变量 Java 数据类型 Java 字符串 Java 类型转换 Java 运算符 Java 字符 ...

  10. Centos 8双网卡设置

    原理:不管开发板是通过直连.路由器还是交换机连接到PC机,最终都是接到PC的以太网网卡(对笔记本来说,一般存在两个网卡,一个WIFI网卡和以太网网卡):因此要实现PC机与虚拟机的互ping,必须把虚拟 ...