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题, 和 必做) 和 (可贪心) (稍难) 第二类 ...
随机推荐
- redhat ent6.5使用centos yum
转载自:http://blog.csdn.net/zhngjan/article/details/20843465 搜狐镜像库:mirrors.sohu.com 163镜像库:mirrors.163. ...
- 图像jpeg压缩
图像分割 8X8 颜色空间转换RGB->YCbCr 3个8X8的矩阵 离散余弦变换:(Discrete cosine transform),简称DCT. DCT转换后的数组中第一个是一个直线数据 ...
- matlab中图片数据类型转换uint8与double
matlab中处理图像像素点数据: img1=double(imread('lenna.bmp')); matlab中imshow图片,要先转换成uint8: subplot(1,2,1),imsho ...
- VC++调节显示器的亮度SetDeviceGammaRamp
出处:http://www.nirsoft.net/vc/change_screen_brightness.html SetDeviceGammaRamp API函数位于Gdi32.ll中,接收一个2 ...
- [原创]adb使用教程v1.1.0-----by-----使用logcat快速抓取android崩溃日志
原文再续,书接上回:<使用logcat快速抓取android崩溃日志>中提到的工具包可以下载拉~ <使用logcat快速抓取android崩溃日志>:http://www.cn ...
- [Intellij idea]解决debug时中文显示方框问题
1. 点击File -> Settings 进入Intellij的设置页面 2. 点击Appearance,选择Override defaults fonts by (not recommend ...
- jquery的jsonp相关
<!DOCTYPE html><html><head ><meta charset="utf-8"><script src=& ...
- POJ 2609 Ferry Loading(双塔DP)
Ferry Loading Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1807 Accepted: 509 Sp ...
- BLOCK方式实现OC程序中多个页面判定用户是否登录
在程序中经常会遇到这种情况,用户刚进入我们软件的时候我们是无需要求用户登录的,但是在下面的页面中,例如收藏,购买等页面的时候,显然在多个页面需要多次判定用户是否登录.试着用block简单的实现了一下该 ...
- transaction 数据库事务 roolback 回滚
事务是恢复和并发控制的基本单位 https://baike.baidu.com/item/数据库事务/9744607 事务有三种模型: 1.隐式事务是指每一条数据操作语句都自动地成为一个事务,事务的开 ...