题目地址: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. java笔记--关于线程死锁

    关于线程死锁 什么是死锁: 在编写多线程的时候,必须要注意资源的使用问题,如果两个或多个线程分别拥有不同的资源, 而同时又需要对方释放资源才能继续运行时,就会发生死锁. 简单来说:死锁就是当一个或多个 ...

  2. 你真的会用AsyncTask吗?(一)

    一个典型AsyncTask的. view source print? 01 public class DialogTestActivity extends Activity { 02     priv ...

  3. [Effective JavaScript 笔记]第40条:避免继承标准类

    ECMAScript标准库里配备了许多重要的类,如Array,function,以及Date等.扩展这些类生成子类可以方便完成很多工作,但它们的定义具有很多特殊的行为,所以很难写出行为正确的类. Ar ...

  4. NGUIJoysticK

    原始的: using UnityEngine; using System.Collections; public class NGUIJoystick : MonoBehaviour { public ...

  5. C++文件输入输出

    #include <iostream> //有些系统里面可以省略此头文件 #include <fstream> #include <string> int main ...

  6. C#模拟百度登录

    目录: 1.fiddler解析百度登录地址 2.处理传入参数 1.fiddler解析百度登录地址 因工作需要,所以研究了下百度的登陆.首先打开https://passport.baidu.com/v2 ...

  7. java将白色背景图片转换成无色

    package com.cxf.dao; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.Buffer ...

  8. Java中删除文件、删除目录及目录下所有文件

    转载自:http://www.cnblogs.com/eczhou/archive/2012/01/16/2323431.html 功能:删除某个目录及目录下的所有子目录和文件 知识点:File.de ...

  9. [Android Pro] 通过IMSI判断手机是移动、联通、电信

    TelephonyManager telManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); /** 获取 ...

  10. “破锣摇滚”乐队(codevs 1444)

    题目描述 Description 你刚刚继承了流行的“破锣摇滚”乐队录制的尚未发表的N(1 <= N <= 20)首歌的版权.你打算从中精选一些歌曲,发行M(1 <= M <= ...