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 Limit: 65536K Total Submissions: 2801 Accepted: 1861 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,h6Sample 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
3.Method:
模拟题,我的方法是想把棋盘初始化好,然后再往里面添棋子
由于很简单,就没有把white和black统一为一种情况,代码不怎么精简
不过对于水题,已经足够了
4.Code:
#include <iostream>
#include <string> using namespace std; int main()
{
//freopen("D://input.txt","r",stdin); int i,j; //init output
string str_out[ + ];
str_out[] = "+---+---+---+---+---+---+---+---+";
for(i = ; i < ; ++i)
{
str_out[i * + ] = "|";
for(j = ; j < ; ++j)
{
if((i + j) % == ) str_out[i * + ] += "...";
else str_out[i * + ] += ":::";
str_out[i * + ] += "|";
}
str_out[(i + ) * ] = "+---+---+---+---+---+---+---+---+";
} string str; //white:
cin >> str;
cin >> str; str = "," + str; //cout << str << endl;
int arr_ch[] = {'K','Q','R','B','N'}; string::size_type str_i;
for(str_i = ; str_i != str.size(); ++str_i)
{
if(str[str_i] == ',')
{
for(i = ; i < ; ++i) if(str[str_i + ] == arr_ch[i]) break;
if(i < )
{
str_out[( - (str[str_i + ] - '')) * + ][ + * (str[str_i + ] - 'a')] = arr_ch[i];
}
else
{
str_out[( - (str[str_i + ] - '')) * + ][ + * (str[str_i + ] - 'a')] = 'P';
}
}
} //black:
cin >> str;
cin >> str;
str = "," + str; //cout << str << endl; for(str_i = ; str_i != str.size(); ++str_i)
{
if(str[str_i] == ',')
{
for(i = ; i < ; ++i) if(str[str_i + ] == arr_ch[i]) break;
if(i < )
{
str_out[( - (str[str_i + ] - '')) * + ][ + * (str[str_i + ] - 'a')] = arr_ch[i] + ('a' - 'A');
}
else
{
str_out[( - (str[str_i + ] - '')) * + ][ + * (str[str_i + ] - 'a')] = 'p';
}
}
} for(i = ; i < ; ++i) cout << str_out[i] << endl; //fclose(stdin); return ;
}
5.Reference:
Poj 2993 Emag eht htiw Em Pleh的更多相关文章
- 模拟 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 ...
- 快速切题 poj 2993 Emag eht htiw Em Pleh 模拟 难度:0
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2806 Accepted: ...
- poj 2993 Emag eht htiw Em Pleh(模拟)
题目:http://poj.org/problem?id=2993 题意:和2996反着 #include <iostream> #include<cstdio> #inclu ...
- POJ 2993:Emag eht htiw Em Pleh
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64 ...
- 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: ...
- 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: ...
- 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 ...
随机推荐
- [置顶] 递归 加引用 实现tree 和 无限级菜单
<?php class k_model_menu_menu { private $data = array(); private $rdata = array(); pr ...
- MYSQL 备份工具
backup of a database is a very important thing. If no backup, meet the following situation goes craz ...
- MAC SVN Phonegap
1. Windows上用VisualSVN Server Manager创建好Repository. 2. 在MAC上,用Phonegap创建好项目,比如在Project1目录里的App目录. 3. ...
- Clustering by density peaks and distance
这次介绍的是Alex和Alessandro于2014年发表在的Science上的一篇关于聚类的文章[13],该文章的基本思想很简单,但是其聚类效果却兼具了谱聚类(Spectral Clustering ...
- php中如何使用phpredis
安装redis服务:下载地址:http://redis.io/download,下载最新文档版本.本教程使用的最新文档版本为 2.8.17,下载并安装: $ wget http://download. ...
- 中兴电信光纤猫F612管理员密码获取方法
1.telnet 192.168.1.1 账号:root 密码:Zte521 2.输入命令: sendcmd 1 DB p DevAuthInfo 得到管理员账号密码如下: <DM name=& ...
- TRF7960天线参数试验
CA1焊47pF就好了,不大用调,主要调CA2的值 图中CA2焊100pF时,读卡距离2cm左右 27pF 3.5cm左右 不焊 4cm左右 47pF 5cm左右 现在手 ...
- windows下使用VirtualEnv
在开发Python应用程序的时候,有时会开发多个应用程序,那这些应用程序都会共用一个Python.如果应用A需要jinja 2.7,而应用B需要jinja 2.6怎么办?这种情况下,每个应用可能需要各 ...
- [设计模式]<<设计模式之禅>>关于开闭原则
开闭原则是Java世界里最基础的设计原则,它指导我们如何建立一个稳定的.灵活的系统,先来看开闭原则的定义: Software entities like classes,modules and fun ...
- [未完成]关于GUI Java图形化界
"笔记内容完成,整体未完成" GUI 图形化用户界面 用java做图形化用户界面的程序不多,大多用C++和defy.因为,Java做图形化效率低. 首先你要安装一个虚拟机,C++是 ...