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: ...
随机推荐
- 初识 swift 封装轮播图
一.简介 换了一家公司.换了一个环境刚开始来公司自然不能有一丝一毫的放松,每天即使是没有什么工作也是看看这个博客.那个源码.尽量让自己更充实.慢慢的开始写几篇博客记录下自己遇到的一些问题和解决方法.其 ...
- Android--自动搜索提示
一. 效果图 在Google或者百度搜索的时候,在输入关键词都会出现自动搜索的提示内容,类似如下的效果,输入b 则出现包含b的相关词条 二. 布局代码 <?xml version="1 ...
- Zigbee技术特点
ZigBee工作原理 基于 ZigBee 的无线设备工作在 868MHZ, 915MHZ 和 2.4Z 频带.其最大数据速 率是 250Kbps. ZigBee 技术主要针对以电池为电源的应用,这些应 ...
- 小心as"陷阱"(c#)
有一种情况,使用as编译时没错,运行时也没错,但是结果错了. object a=1; string b=a as String; 由于a是objecy类型,是引用类型,所以可以用as转换,但是实际上b ...
- MVC学习Day02之校验
MVC校验有两种方法: 方法一:自己动手写js---------略 方法二: l在View的页面中,首先指定页面强类型@model 类型 l使用Html.***For(model=>model. ...
- java Thread编程(三) 同步的两种不同实现方式
1,创建需要同步的对象(方式一) package concurrency; public class Bank { private double amount; public Bank(double ...
- nodeJs抓取网页
var fs = require('fs'); var jquery = require('jquery'); var url = require('url'); var data = { 0 : ' ...
- hdu3397 线段树 成段更新
这题真的呵呵了.敲了很长时间,调了很多bug,把0 1 输出,解决了.最后想取反,怎么搞都有bug, 最后还是看了大牛们的博客.不过这题真的敲得爽,调bug时基本把线段树过程全部弄了一遍. #incl ...
- c语言的数学函数ceil、floor、round
头文件<math.h> 函数原型和作用 double ceil(double x); 向上取整 double floor(double x); 向下取整 double round(doub ...
- Java编程思想学习(十) 正则表达式
正则表达式是一种强大的文本处理工具,使用正则表达式我们可以以编程的方法,构造复杂的文本模式,并且对输入的字符串进行搜索.在我看来,所谓正则表达式就是我们自己定义一些规则,然后就可以验证输入的字符串是不 ...