模拟 POJ 2993 Emag eht htiw Em Pleh
题目地址:http://poj.org/problem?id=2993
/*
题意:与POJ2996完全相反
模拟题 + 字符串处理:无算法,读入两行字符串找出相应点用used标记,输出时标记过的输出字母,否则输出'.'或':'。
注意:棋盘的行的顺序是从下到上递增的
*/
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <map>
#include <queue>
#include <vector>
using namespace std; const int MAXN = 1e3 + ;
const int INF = 0x3f3f3f3f;
int used[MAXN][MAXN];
char a[MAXN][MAXN];
map<char, int> m;
string s1,s2; void print(int tw, int tb)
{
bool flag = false;
for (int i=; i<=; ++i)
{
cout << "+---+---+---+---+---+---+---+---+" << endl;
cout << "|";
flag = !flag;
for (int j=; j<=; ++j)
{
(flag) ? cout << "." : cout << ":";
if (!used[i][j]) (flag) ? cout << "." : cout << ":";
else
{
cout << a[i][j];
}
(flag) ? cout << "." : cout << ":";
flag = !flag;
cout << "|";
}
cout << endl;
} cout << "+---+---+---+---+---+---+---+---+" << endl;
} void work(void)
{
int tw = , tb = ;
for (int i=; s1[i]!='\0'; ++i) //White
{
if (s1[i] == ',') continue;
if (s1[i]<='S' && s1[i] >= 'B')
{
a[-(s1[i+]-'')][m[s1[i+]]] = s1[i];
used[-(s1[i+]-'')][m[s1[i+]]] = ;
i += ;
}
if (s1[i]<='s' && s1[i]>='a')
{
a[-(s1[i+]-'')][m[s1[i]]] = 'P';
used[-(s1[i+]-'')][m[s1[i]]] = ;
i += ;
}
if (i >= s1.size ()) break;
}
for (int i=; s2[i]!='\0'; ++i) //Black
{
if (s2[i] == ',') continue;
if (s2[i]<='S' && s2[i] >= 'B')
{
a[-(s2[i+]-'')][m[s2[i+]]] = s2[i] - 'A' + 'a';
used[-(s2[i+]-'')][m[s2[i+]]] = ;
i += ;
}
if (s2[i]<='s' && s2[i]>='a')
{
a[-(s2[i+]-'')][m[s2[i]]] = 'p';
used[-(s2[i+]-'')][m[s2[i]]] = ;
i += ;
}
if (i >= s2.size ()) break;
} print (tw, tb);
} int main(void) //POJ 2993 Emag eht htiw Em Pleh
{
//freopen ("J.in", "r", stdin); char ch = 'a';
for (int i=; i<=; ++i)
{
m[ch++] = i;
} getline (cin, s1);
getline (cin, s2);
memset (used, , sizeof (used));
work (); return ;
} /*
+---+---+---+---+---+---+---+---+
*/ /*
+---+---+---+---+---+---+---+---+
|.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.|
+---+---+---+---+---+---+---+---+
*/
模拟 POJ 2993 Emag eht htiw Em Pleh的更多相关文章
- 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
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 题意:和2996反着 #include <iostream> #include<cstdio> #inclu ...
- 模拟 + 打表 --- Emag eht htiw Em Pleh
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2578 Accepted: ...
- 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: ...
随机推荐
- 以DDD为开发模式的设计开发步骤可以是
以DDD为开发模式的设计开发步骤可以是:1)分析需求:2)画出用例图,系统中各个角色如何使用系统,也包括外部系统如何使用系统,也包括系统中到某个时间点自动启动的某些功能(此时角色就是时间):3)针对各 ...
- ASP.NET中树型DropDownList的绑定
首先设计好数据库,假设数据库有三个字段Id,ParentId,Name.ParentId是树性结构必须的,就是节点的父节点id,假设跟节点id都是0.下面就可以绑定了! 思路应该很简单,就是先绑定根节 ...
- Unity3D占用内存太大的解决方法
原地址:http://www.cnblogs.com/88999660/archive/2013/03/15/2961663.html 最近网友通过网站搜索Unity3D在手机及其他平台下占用内存太大 ...
- HDU 4435 charge-station () bfs图论问题
E - charge-station Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u ...
- linux 搭建hexo博客
搭建环境: CentOS 6.5 1.安装git的编译包 yum -y install gcc zlib-devel openssl-devel perl cpio expat-devel gette ...
- Javascript样例之文档章节滚动全版(DOM)
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABBMAAAC5CAIAAAD1bOCRAAAMEUlEQVR4nO3d4XEbyREGUGRCZQDGcG
- Simple Chroma Key 0.1.16 图片抠像(vs2003) 无任何插件
学习扣像的最基础代码 (只支持 BMP TGA) simplechromakey.rar
- 利用VMware虚拟机(Android-x86 2.2)和eclipse,调试安卓代码
下载 android-x86-2.2-generic.iso (这里包含eth0) http://www.android-x86.org/download XP32位 只能使用 VMware Wor ...
- [小细节,大BUG]记录一些小问题引起的大BUG(长期更新....)
[小细节,大BUG] 6.问题描述:当从Plist文件加载数据,放入到tableView中展示时,有时有数据,有时又没有数据.这是为什么呢?相信很多大牛都想到了:我们一般将加载的数据,转换成模型,放入 ...
- 安装chocolatey
C:\> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.web ...