模拟 + 打表 --- Emag eht htiw Em Pleh
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 2578 | Accepted: 1731 |
Description
Input
Output
Sample Input
- White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4
- Black: Ke8,Qd8,Ra8,Rh8,Bc8,Ng8,Nc6,a7,b7,c7,d7,e7,f7,h7,h6
Sample Output
- +---+---+---+---+---+---+---+---+
- |.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.|
- +---+---+---+---+---+---+---+---+
【题目来源】
【题目大意】
这题和上一题是相关联的,上一题是给棋盘让你输出棋子的坐标,这题时给坐标让你输出棋盘。
【题目分析】
先将整个棋盘的初始状态打表存放起来,然后每次都初始化,输入坐标后更新数组的值,最后输出。
思路清晰就能1A。
- #include<cstdio>
- #include<cstring>
- char Map[][];
- char Graph[][]=
- {
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- '|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- '|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- '|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- '|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- '|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- '|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- '|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|',
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- '|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',':',':',':','|','.','.','.','|',
- '+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+','-','-','-','+',
- };
- void make_table()
- {
- for(int i=;i<;i++)
- for(int j=;j<;j++)
- Map[i][j]=Graph[i][j];
- }
- char w[];
- char b[];
- void update1(char c,char x1,char y1)
- {
- int x=(-(y1-'')+)*-;
- int y=(x1-'a'+)*-;
- Map[x][y]=c;
- }
- void update2(char c,char x1,char y1)
- {
- int x=(-(y1-'')+)*-;
- int y=(x1-'a'+)*-;
- Map[x][y]=c+;
- }
- void update3(char x1,char y1)
- {
- int x=(-(y1-'')+)*-;
- int y=(x1-'a'+)*-;
- Map[x][y]='P';
- }
- void update4(char x1,char y1)
- {
- int x=(-(y1-'')+)*-;
- int y=(x1-'a'+)*-;
- Map[x][y]='p';
- }
- int main()
- {
- while(scanf("White: %s",w)!=EOF)
- {
- getchar();
- scanf("Black: %s",b);
- getchar();
- make_table();
- int len1=strlen(w);
- int len2=strlen(b);
- for(int i=;i<len1;)
- {
- if(w[i]>='A'&&w[i]<='Z')
- {
- update1(w[i],w[i+],w[i+]);
- i+=;
- }
- else if(w[i]>='a'&&w[i]<='z')
- {
- update3(w[i],w[i+]);
- i+=;
- }
- }
- for(int i=;i<len2;)
- {
- if(b[i]>='A'&&b[i]<='Z')
- {
- update2(b[i],b[i+],b[i+]);
- i+=;
- }
- else if(b[i]>='a'&&b[i]<='z')
- {
- update4(b[i],b[i+]);
- i+=;
- }
- }
- for(int i=;i<;i++)
- {
- for(int j=;j<;j++)
- printf("%c",Map[i][j]);
- puts("");
- }
- }
- return ;
- }
模拟 + 打表 --- Emag eht htiw Em Pleh的更多相关文章
- 模拟 POJ 2993 Emag eht htiw Em Pleh
题目地址:http://poj.org/problem?id=2993 /* 题意:与POJ2996完全相反 模拟题 + 字符串处理:无算法,读入两行字符串找出相应点用used标记,输出时标记过的输出 ...
- 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: ...
- 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: ...
- 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 ...
- Emag eht htiw Em Pleh(imitate)
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2901 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 ...
- 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 ...
- POJ 2993:Emag eht htiw Em Pleh
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %I64d & %I64 ...
随机推荐
- json方式的面向对象、拖拽
//json方式的面向对象 var obj= { a:, b:, c:function(){ alert( } } obj.c();//12 //命名空间 var miaov={}; miaov.co ...
- 藏红花StigmaCroci西红花StigmaCroci番红花
伊朗藏红花(StigmaCroci)是一种耐旱植物,适于生长在冬季最低气温不低于零下20度,夏季最高气温不高于零上35度且气候干燥的地区. 因其水土和气候条件的限制,除了伊朗能大量种植外,希腊.印度. ...
- 开机注册联通2G网络
2/3G PLMN LIST 在MM_RATCM_PLMN_LIST_CNF或NWSEL_MM_PLMN_SEARCH_CNF消息中可以查看2,3G搜到的PLMN LIST 内容如下: RAT:Rad ...
- JAVA concurrent包下Semaphore、CountDownLatch等用法
CountDownLatch 跟join的区别 CountDownLatch用处跟join很像,但是CountDownLatch更加灵活,如果子线程有多个阶段a.b.c; 那么我们可以实现在a阶段完成 ...
- Xcode添加库文件framework (转)
首先需要了解一下iOS中静态库和动态库.framework的概念 静态库与动态库的区别 首先来看什么是库,库(Library)说白了就是一段编译好的二进制代码,加上头文件就可以供别人使用. 什么时候我 ...
- JS在HTML文档引入位置
我们今天来聊一聊关于JavaScript文件的引入位置的问题:大家在平时的Web开发中有没有想过这样一个问题,那就是我应该在文档的头部(也就是<head>标签内部里面)引入所需要的Java ...
- centos7删除PHP怎么操作
前面我们说了centos7删除MariaDB,现在我们说说centos7删除PHP怎么操作?当然不是特殊需要,不要去删除PHP,后果很严重.操作之前请做好所有的备份!首先查看有没安装php以及版本 # ...
- 01-C#笔记-hello_world
/* * 主文件是 xxx.cs * 基本的 hello world 程序如下: */ using System; using System.Collections.Generic; using Sy ...
- Layui 模板引擎中用了CheckBox,显示时没有样式
渲染完成后,需要重新调用layui的方法. layui.form.render();
- python paramiko与linux的连接
两种使用paramiko连接到linux服务器的代码 方式一: 1 ssh = paramiko.SSHClient() 2 ssh.set_missing_host_key_policy(param ...