题目地址: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的更多相关文章

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

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

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

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

  4. poj 2993 Emag eht htiw Em Pleh(模拟)

    题目:http://poj.org/problem?id=2993 题意:和2996反着 #include <iostream> #include<cstdio> #inclu ...

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

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

  6. POJ 2993:Emag eht htiw Em Pleh

    Emag eht htiw Em Pleh Time Limit: 1000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64 ...

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

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

  9. Emag eht htiw Em Pleh(imitate)

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

随机推荐

  1. string,const char*,char*之间的相互转换

    1. string转const char* string s = "abc"; const char* c_s = s.c_str(); 2. const char*转string ...

  2. HDU 1018 Big Number (数学题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1018 解题报告:输入一个n,求n!有多少位. 首先任意一个数 x 的位数 = (int)log10(x ...

  3. [Unity3D]计时器/Timer

    原地址:http://blog.sina.com.cn/s/blog_5b6cb9500101aejs.html https://github.com/xuzhiping7/Unity3d-Timer ...

  4. nyoj 20

    http://acm.nyist.net/JudgeOnline/message.php?msg=已提交&url=status.php%3Fpid%3D20&second=0 #inc ...

  5. ntpdate公司测试

    [root@i158 ~]# ntpdate -u time.uuwatch.com 9 Jul 11:18:50 ntpdate[853]: no server suitable for synch ...

  6. C语言指针总结

    C语言中的精华是什么,答曰指针,这也是C语言中唯一的难点. C是对底层操作非常方便的语言,而底层操作中用到最多的就是指针,以后从事嵌入式开发的朋友们,指针将陪伴我们终身. 本文将从八个常见的方面来透视 ...

  7. 71 Query Rank Min Max Successor of BST

    [本文链接] http://www.cnblogs.com/hellogiser/p/query-min-max-successor-of-bst.html [代码]  C++ Code  12345 ...

  8. 58. 分析、测试与总结:罗马数字和阿拉伯数字的转换[roman to integer and integer to roman in c++]

    [本文链接] http://www.cnblogs.com/hellogiser/p/roman-to-integer-and-integer-to-roman.html [题目] 给出一个罗马数字, ...

  9. 26.打印所有和为S的连续正整数序列[FindContinuousSequencesWithSumS]

    [题目] 输入一个正数n,输出所有和为n连续正数序列.例如输入15,由于1+2+3+4+5=4+5+6=7+8=15,所以输出3个连续序列1-5.4-6和7-8. [分析] 这是网易的一道面试题.这道 ...

  10. Java异常与异常处理简单使用

    异常就是程序运行过程中阻止当前方法或作用域继续执行的问题: 任何程序都不能保证完全正常运行,当发生异常时,需要我们去处理异常,特别是一些比较重要的场景,异常处理的逻辑也会比较复杂,比如:给用户提示.保 ...