poj2993
#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
struct point
{
int i,j;
int num;
char c;
}p[1000];
int find(char n)
{
if(n=='a') return 2;
if(n=='b') return 6;
if(n=='c') return 10;
if(n=='d') return 14;
if(n=='e') return 18;
if(n=='f') return 22;
if(n=='g') return 26;
if(n=='h') return 30;
}
int ok(char n)
{
if(n=='1') return 15;
if(n=='2') return 13;
if(n=='3') return 11;
if(n=='4') return 9;
if(n=='5') return 7;
if(n=='6') return 5;
if(n=='7') return 3;
if(n=='8') return 1;
}
int main()
{
int i,j,n,m,k;
char s[17][35]={ {"+---+---+---+---+---+---+---+---+"},
{"|...|:::|...|:::|...|:::|...|:::|"},
{ "+---+---+---+---+---+---+---+---+"},
{"|:::|...|:::|...|:::|...|:::|...|"},
{"+---+---+---+---+---+---+---+---+"},
{"|...|:::|...|:::|...|:::|...|:::|"},
{"+---+---+---+---+---+---+---+---+"},
{"|:::|...|:::|...|:::|...|:::|...|"},
{"+---+---+---+---+---+---+---+---+"},
{"|...|:::|...|:::|...|:::|...|:::|"},
{ "+---+---+---+---+---+---+---+---+"},
{ "|:::|...|:::|...|:::|...|:::|...|"},
{"+---+---+---+---+---+---+---+---+"},
{"|...|:::|...|:::|...|:::|...|:::|"},
{"+---+---+---+---+---+---+---+---+"},
{"|:::|...|:::|...|:::|...|:::|...|"},
{ "+---+---+---+---+---+---+---+---+"} }; char s1[1005],s2[1005],c;
char st[10];
scanf("%s",st);
getchar();
gets(s1);
m=strlen(s1);
int sum=0,a,b;
for(i=0;i<m;i++)
{
sum++;
if(s1[i]==',' || i==m-1)
{
if(sum==4)
{
a=find(s1[i-2]);
b=ok(s1[i-1]);
s[b][a]=s1[i-3];
}
if(sum==3 && i!=m-1)
{
a=find(s1[i-2]);
b=ok(s1[i-1]);
s[b][a]='P';
}
if(i==m-1)
{
if(sum==2)
{
a=find(s1[i-1]);
b=ok(s1[i]);
s[b][a]='P';
}
if(sum==3)
{
a=find(s1[i-1]);
b=ok(s1[i]);
s[b][a]=s1[i-2];
}
}
sum=0;
}
}
scanf("%s",st);
getchar();
gets(s2);
m=strlen(s2);
sum=0;
for(i=0;i<m;i++)
{
sum++;
if(s2[i]==',' || i==m-1)
{
if(sum==4)
{
a=find(s2[i-2]);
b=ok(s2[i-1]);
s[b][a]=s2[i-3]+32;
}
if(sum==3 && i!=m-1)
{
a=find(s2[i-2]);
b=ok(s2[i-1]);
s[b][a]='p';
}
if(i==m-1)
{
if(sum==2)
{
a=find(s2[i-1]);
b=ok(s2[i]);
s[b][a]='p';
}
if(sum==3)
{
a=find(s2[i-1]);
b=ok(s2[i]);
s[b][a]=s2[i-2]+32;
}
}
sum=0;
}
}
for(i=0;i<17;i++)
printf("%s\n",s[i]);
return 0;
}
poj2993的更多相关文章
- POJ-2993 Emag eht htiw Em Pleh---棋盘模拟
题目链接: https://vjudge.net/problem/POJ-2993 题目大意: 输入和输出和这里相反. 思路: 模拟题,没啥算法,直接模拟,不过为了代码精简,还是花了一点心思的 #in ...
- poj2993 翻转2996
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2944 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 ...
- POJ2993——Help Me with the Game(字符串处理+排序)
Help Me with the Game DescriptionYour task is to read a picture of a chessboard position and print i ...
- poj2993 poj2669
扯淡题. 2993 #include <iostream> #include <stdio.h> #include <string> #include <st ...
- 【POJ2993】Emag eht htiw Em Pleh
题目传送门 本题知识点:模拟(如果对国际象棋不熟悉的同学可以先百度一下) 本题跟POJ2996是逆过来的操作,如果做过[POJ2996]的同学就不会对题意不理解的了. (以下默认您已AC[POJ299 ...
- poj分类 很好很有层次感。
初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. ( ...
- 【转】POJ题目分类推荐 (很好很有层次感)
OJ上的一些水题(可用来练手和增加自信) (poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)初期: 一. ...
- 【转】ACM训练计划
[转] POJ推荐50题以及ACM训练方案 -- : 转载自 wade_wang 最终编辑 000lzl POJ 推荐50题 第一类 动态规划(至少6题, 和 必做) 和 (可贪心) (稍难) 第二类 ...
随机推荐
- 首次接触XAMPP,端口被占用困恼
本人运气比较好,首次安装XAMPP就碰到了各种问题啊!并且已经解决,以下是我问题的出处并且解决. 问题描述: apache无法打开,并且连带的出现了mySql无法打开.(即80端口冲突问题) 解决办法 ...
- redhat ent6.5使用centos yum
转载自:http://blog.csdn.net/zhngjan/article/details/20843465 搜狐镜像库:mirrors.sohu.com 163镜像库:mirrors.163. ...
- 【机器学习具体解释】KNN分类的概念、误差率及其问题
转载请注明出处:http://blog.csdn.net/luoshixian099/article/details/50923056 勿在浮沙筑高台 KNN概念 KNN(K-Nearest Neig ...
- 该如何将MathType公式粘贴到文档中
MathType是一款非常好用的数学公式编辑器,因为它与很多的文档处理器都能够很好地兼容,因此其使用范围非常的大.MathType公式编辑器编辑的公式与数学符号等都符号国际期刊的出版标准,并且上手容易 ...
- 《Node.js入门》CentOS 6.5下Node.js Web开发环境搭建笔记
近期想尝试一下英特尔的基于WebRTC协同通信开发套件,所以须要在本地搭建Node.js Web的开发測试环境. 这里讲的是CentOS 下的搭建方法.使用Windows的小伙伴请參考: <No ...
- std::stringstream(2)
stringstream本身的复制构造函数是私有的,无法直接用,于是带来了一些复杂的问题 网上,流传着几种办法,如streamA.str(streamB.str()),但这种办法,复制的仅仅是初始化时 ...
- Mininet加强版——DOT(分布式OpenFlow试验平台)
前言 之前在做SDN实验的时候,需要用到包含2000+个交换机的fattree拓扑,当时用的是mininet,生成整个拓扑需要十五六个小时,最终在异常艰苦的环境下做完了实验,之后听说了有DOT(Dis ...
- sql的case when then else end 的语法实现列转行
SELECT * FROM test5 ; RESOURCES DATETIME CNT ID1 0 2018-01-22 4 12 0 2018-01-24 10 23 0 2018-01-25 2 ...
- Oracle Schema Objects——Tables——Table Compression
Oracle Schema Objects Table Compression 表压缩 The database can use table compression to reduce the amo ...
- FineUI 获取x_state并解析
public JObject PostBackStates() { JObject xState = null; if (Page.IsPostBack) { string state = HttpC ...