POJ 2993:Emag eht htiw Em Pleh
Time Limit: 1000MS | Memory Limit: 65536KB | 64bit IO Format: %I64d & %I64u |
Description
input.
Input
Output
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的更多相关文章
- 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 ...
- 模拟 POJ 2993 Emag eht htiw Em Pleh
题目地址:http://poj.org/problem?id=2993 /* 题意:与POJ2996完全相反 模拟题 + 字符串处理:无算法,读入两行字符串找出相应点用used标记,输出时标记过的输出 ...
- 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 ...
- 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: ...
- 快速切题 poj 2993 Emag eht htiw Em Pleh 模拟 难度:0
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2806 Accepted: ...
- 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 ...
- 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 ...
- Emag eht htiw Em Pleh(imitate)
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2901 Accepted: ...
- 模拟 + 打表 --- Emag eht htiw Em Pleh
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2578 Accepted: ...
随机推荐
- Windows和linux命令行快捷键
Powershell的快捷键和cmd,linux中的shell,都比较像. ALT+F7 清除命令的历史记录 PgUp PgDn 显示当前会话的第一个命令和最后一个命令 Enter 执行当前命令 En ...
- Ubuntu下安装 Mysql
MYSQL在ubuntu16.04下的编译安装mysql-5.6.23.tar.gz 为减少安装过程中因权限带来个各种问题,建议全程用root用户编译安装,步骤如下: 1.安装依赖文件 apt-ge ...
- R 读取回归模型的信息
参考博客: http://blog.sina.com.cn/s/blog_8f5b2a2e0101fmiq.html https://blog.csdn.net/huangyouyu523/artic ...
- other#apache-commons
if you want to be a better javaer, you should spent time on apache commons.
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 字体图标(Glyphicons):glyphicon glyphicon-cog
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 字体图标(Glyphicons):glyphicon glyphicon-pencil
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name ...
- dedecms 标签使用 runphp=php 获取文章静态地址
[field:id runphp='yes'] $url=GetOneArchive(@me); @me=$url['arcurl']; [/field:id]
- Maven插件方式使用Mybatis Generator
Mybatis Generator Mybatis Generator简称MBG,可以根据数据库自动生成实体类.单表查询接口及其映射xml文件(也可以选择以注解方式生成). 下面介绍一下以maven插 ...
- C语言备忘录——取余与取模
前几天,一个小姐姐问我取余和取模有什么区别,我当时第一反应就是二者是一样的,但是小姐姐咬死说不一样.我去百度了一下还真的不一样.脑壳疼,我当初误导了多少人.所以为了帮助我记忆也为了帮助预防我误人子弟 ...
- 1 —— js 语法回顾 —— 数据类型。流程控制。数组
一,数据类型 字符串 . 数值 .布尔. null . undefined . 对象 ( 数组 . 函数 function(){} . object) undefined 出现的情景 : (1)变 ...