Emag eht htiw Em Pleh(imitate)
| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 2901 | Accepted: 1917 |
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.|
+---+---+---+---+---+---+---+---+
Source
#include<stdio.h>
#include<string.h>
#include<ctype.h>
char chess[][] ;
char st[] = "+---+---+---+---+---+---+---+---+" ;
char s1[] = "|...|:::|...|:::|...|:::|...|:::|" ,s2[] = "|:::|...|:::|...|:::|...|:::|...|" ;
char color[] ;
char ch ;
int row , col; int main ()
{
// freopen ("a.txt" , "r" , stdin) ;
for (int i = ; i <= ; i++) {
if (i & ) {
strcpy (chess[i] , st) ;
}
else {
if ((i >> ) & )
strcpy (chess[i] , s1) ;
else
strcpy (chess[i] , s2) ;
}
}
gets (color) ;
int len = strlen (color) ;
color [len] = ',' ;
color [len + ] = '\0' ;
color [] = ',' ; for (int i = ; color[i] != '\0' ; i ++) {
int cnt = ;
if (color[i] == ',') {
for (int j = i - ; cnt < ; j-- , cnt++) {
if (cnt == )
row = ( - (color[j] - '') ) * ;
if (cnt == )
col = (color [j] - 'a') * + ;
if (cnt == ) {
if (color[j] == ',')
ch = 'P' ;
else
ch = color[j] ;
}
}
}
chess[row][col] = ch ;
} gets (color) ;
len = strlen (color) ;
color [len] = ',' ;
color [len + ] = '\0' ;
color [] = ',' ; for (int i = ; color[i] != '\0' ; i ++) {
int cnt = ;
if (color[i] == ',') {
for (int j = i - ; cnt < ; j-- , cnt++) {
if (cnt == )
row = ( - (color[j] - '') ) * ;
if (cnt == )
col = (color [j] - 'a') * + ;
if (cnt == ) {
if (color[j] == ',')
ch = 'p' ;
else
ch = tolower (color[j]) ;
}
}
}
chess[row][col] = ch ;
} for (int i = ; i <= ; i++)
puts (chess[i]) ; return ;
}
Emag eht htiw Em Pleh(imitate)的更多相关文章
- poj 2993 Emag eht htiw Em Pleh(模拟)
题目:http://poj.org/problem?id=2993 题意:和2996反着 #include <iostream> #include<cstdio> #inclu ...
- 模拟 POJ 2993 Emag eht htiw Em Pleh
题目地址:http://poj.org/problem?id=2993 /* 题意:与POJ2996完全相反 模拟题 + 字符串处理:无算法,读入两行字符串找出相应点用used标记,输出时标记过的输出 ...
- 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 ...
- 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 模拟 难度:0
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2806 Accepted: ...
- 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 ...
- 模拟 + 打表 --- Emag eht htiw Em Pleh
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2578 Accepted: ...
随机推荐
- AngularJS开发指南4:指令的详解
指令是我们用来扩展浏览器能力的技术之一.在DOM编译期间,和HTML元素关联着的指令会被检测到,并且被执行.这使得指令可以为DOM指定行为,或者改变它. AngularJS有一套完整的.可扩展的.用来 ...
- C语言和数据结构的书单-再次推荐
一.推荐专业书单: 1) C语言方面: n 明解C语言——适合初学者 豆瓣链接:https://book.douban.com/subject/23779374/ 推荐理由:< ...
- 拦路虎:jQuery
1. color设置无效的问题! $("#subscribe").hover(function(){ var $this = $("#subscribe .subsc ...
- 转-JS之Window对象
一.说明:他是JS中最大的对象,它描述的是一个浏览器窗口,一般要引用他的属性和方法时,不需要用“Window.XXX”这种形式,而是直接使用“XXX”.一个框架页面也是一个窗口. 二.Window窗口 ...
- User Attributes - Inside Active Directory
User Attributes - Inside Active Directory Related to the book Inside Active Directory, ISBN 0-201-61 ...
- xml文件的读写操作
1.直接上代码:包含了xml文档的创建,读取xml文档,创建根节点,向根节点中添加子节点,保存xml文档----------先来张效果图: static void Main(string[] args ...
- session共享
Nginx或者Squit反向代理到两台tomcat服务器 tomcat使用memcached tomcat连接memcached工具 cp session/*.jar /usr/local/tomca ...
- 2.Android之按钮Button和编辑框EditText学习
今天学习android一些基本控件:button和edittext使用,我们平时网页或者手机登录一般都会有登录框,这里面就用到这两个部件. 如图: 所对应XML文件: 一般第二个编辑框都是输入密码,所 ...
- 粒子群优化算法-python实现
PSOIndividual.py import numpy as np import ObjFunction import copy class PSOIndividual: ''' individu ...
- UVa 1025 A Spy in the Metro
http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=35913 预处理出每个时间.每个车站是否有火车 为了方便判断是否可行,倒推处理 ...