模拟 + 打表 --- 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 ...
随机推荐
- druid + mysql + mybatis 批量更新报错
首先 批量更新报错 sql injection violation, multi-statement not allow 然后看了博客:https://blog.csdn.net/qq_3634595 ...
- Django框架(九)-- 多表操作:一对一、一对多、多对多的增删改,基于对象/双下划线的跨表查询、聚合查询、分组查询、F查询与Q查询
一.创建多表模型 一对一:OneToOneField 一对多:ForeignKey 多对多:ManyToManyField 创建表时,会自动添加一个nid字段,并且自增,所以id可以不用手动创建 On ...
- django2外键,F表达式,Q表达式
一对多 环境 两个类:书的类别和文章,一片文章只能有一个作者,一个作者可以有多个文章,这之间组成了一对多的关系 class Category(models.Model): category = mod ...
- Apache Flink流式处理
花了四小时,看完Flink的内容,基本了解了原理. 挖个坑,待总结后填一下. 2019-06-02 01:22:57等欧冠决赛中,填坑. 一.概述 storm最大的特点是快,它的实时性非常好(毫秒级延 ...
- system.exit(int status)中status值不同时的区别
status为0时为正常退出程序,也就是结束当前正在运行中的java虚拟机. status为非0的其他整数(包括负数,一般是1或者-1),表示非正常退出当前程序. 可以明确的是,无论status是什么 ...
- locust手机号批量注册性能测试
from locust import TaskSet,task,HttpLocust from common.redisCon import redis_clusters import queue c ...
- 第12节-BLE协议HCI层的数据格式
学习资料: 1. 蓝牙协议core_v5.0.pdf <Vol 2: Core System Package [BR/EDR Controller volume]>的“Part E: Ho ...
- python 文本全选
这个是一个控制框有效果 # encoding: utf-8 from Tkinter import * def printentry(event): print("click on" ...
- 可怕的Full GC (转自Hbase不睡觉书)
PS:之前做项目的时候,需要做个复杂的查询,大量的查询总是导致hbase集群奔溃,最后定位到时full GC的原因. 以下转自<Hbase不睡觉书>-------------------- ...
- 阿里云centos 7上面安装mysql5.7的详细步骤!!!
前言: 网上太多的linux 的安装mysql教程,很多教程不全或者因为环境不一致导致无法成功安装,以下是亲测的可行性的方法,请参考. 步骤: Centos7操作系统YUM库列表里默认不再提供MySQ ...