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. Codeforces 546 E:士兵的旅行 最大网络流

    E. Soldier and Traveling time limit per test 1 second memory limit per test 256 megabytes input stan ...

  2. Redis——进阶

    redis的持久化 redis提供两种备份方式,一种是RDB 一种是AOFRDB默认开启.关闭注释掉所有的save,存储的是redis 具体的值,会压缩存储.AOF配置文件中appendonly ye ...

  3. 解决上传代码到GitHub报错Push rejected: Push to origin/master was rejected

    最近在 push 代码到 github 时,IDEA报错 Push rejected: Push to origin/master was rejected 在网友找了一圈,发现都不是想要的答案 于是 ...

  4. Django(五)1 - 4章实战:从数据库读取图书列表并渲染出来、通过url传参urls.py path,re_path通过url传参设置、模板语法

    一.从数据库读取图书数据并渲染出来 1)app1/views.py函数books编写 [1]从模型下导入bookinfo信息 [2]从数据库获取图书对象列表 [3]把获取到的图书对象赋值给books键 ...

  5. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 字体图标(Glyphicons):glyphicon glyphicon-info-sign

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...

  6. JavaScript动态实现div窗口弹出&消失功能

    先积累一个JavaScript动态实现div窗口弹出&消失功能 首先是index.jsp代码 <html> <head> <link rel="styl ...

  7. CSS隐藏商务通等内容

    CSS隐藏商务通等内容<style>#qiao-wrap{display:none !important;} </style>

  8. 2.9 学习总结 之 【Android】体温统计APP

    一.说在前面 昨天 学习了JQ的相关知识 今天 编写体温统计APP 我的工程源码:https://github.com/xiaotian12-call/Take-body-temperature 二. ...

  9. 小程序 scroll-view 中文字不换行问题

    问题描述:在scroll-view 中scroll-x="true"时控制文字超出显示省略号,要求如图: 但实际中会出现如文字不换行或样式错乱的问题. 横向滚动的实现如下: 超过两 ...

  10. Asp.net mvc项目分页功能

    1.定义一个分页用的Page<T>类 /* 使用示例: var pager = new Pager<Article>( this.ControllerContext, //上下 ...