poj2993 翻转2996
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 2944 | Accepted: 1949 |
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>
char map[10][10],str1[100],str2[100];
int main(){
while(gets(str1)){
gets(str2);
int len1=strlen(str1);
int len2=strlen(str2);
for(int i=0;i<=len1-1;i++){
if(str1[i]>='1'&&str1[i]<='9'){
if(str1[i-2]!=',')
map[str1[i]-'1'+1][str1[i-1]-'a'+1]=str1[i-2];
else
map[str1[i]-'1'+1][str1[i-1]-'a'+1]='P';
}
}
for(int i=0;i<=len2-1;i++){
if(str2[i]>='1'&&str2[i]<='9'){
if(str2[i-2]!=',')
map[str2[i]-'1'+1][str2[i-1]-'a'+1]=str2[i-2]+32;
else
map[str2[i]-'1'+1][str2[i-1]-'a'+1]='p';
}
}
printf("+---+---+---+---+---+---+---+---+\n");
for(int i=8;i>=1;i--){
printf("|");
for(int j=1;j<=8;j++){
if((i+j)%2==0){
printf(":");
if(map[i][j]) printf("%c",map[i][j]);
else printf(":");
printf(":");
}
else {
printf(".");
if(map[i][j]) printf("%c",map[i][j]);
else printf(".");
printf(".");
}
printf("|");
}
printf("\n");
printf("+---+---+---+---+---+---+---+---+\n");
}
memset(str1,0,sizeof(str1));
memset(str2,0,sizeof(str2));
memset(map,0,sizeof(map));
}
return 0;
}
poj2993 翻转2996的更多相关文章
- [LeetCode] Reverse Vowels of a String 翻转字符串中的元音字母
Write a function that takes a string as input and reverse only the vowels of a string. Example 1:Giv ...
- [LeetCode] Reverse String 翻转字符串
Write a function that takes a string as input and returns the string reversed. Example: Given s = &q ...
- [LeetCode] Flip Game 翻转游戏
You are playing the following Flip Game with your friend: Given a string that contains only these tw ...
- [LeetCode] Invert Binary Tree 翻转二叉树
Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9 to 4 / \ 7 2 / \ / \ 9 6 3 1 Trivia: This problem wa ...
- [LeetCode] Reverse Words in a String II 翻转字符串中的单词之二
Given an input string, reverse the string word by word. A word is defined as a sequence of non-space ...
- [LeetCode] Reverse Words in a String 翻转字符串中的单词
Given an input string, reverse the string word by word. For example, Given s = "the sky is blue ...
- [LeetCode] Reverse Nodes in k-Group 每k个一组翻转链表
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If ...
- [LeetCode] Reverse Integer 翻转整数
Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to ...
- canvas-图片翻转
图片90度翻转 在canvas中插入图片需先加载图片(利用Image对象);加载完成后再执行操作drawImage(obj,x,y,w,h) 插入图片的坐标宽高等值 <!DOCTYPE html ...
随机推荐
- C#基础知识系列三(类和结构体、String和StringBuilder、equals和==)
前言 这一节主要来了解一下类和结构体之间的异同点.以及针对String和StringBuilder的用法.equals和==,其实可以看出很多地方都用到了上一节的值类型和引用类型.堆栈和装箱拆箱操作吧 ...
- AngularJS开发指南2:AngularJS初始化过程
自动初始化 请将ng-app指令放到你应用的标签节点中, 如果你想要AngularJS自动执行整个<html>程序就把它放在 <html> 标签中.比如:<html ng ...
- 团队项目--关于QQ项目的运行和总结
目前为止该QQ项目实现如下功能:添加好友到好友列表,可以把好友在不同分类中移动,同时支持离线查找添加好友,离线更换头像,离线发送消息,保存所有好友聊天记录,发送窗口抖动,查看对方信息,更改/添加信息等 ...
- Gson解析Json格式数据
//数据定义:=========================================== class User{ String name; String password; String ...
- HTML布局篇之双飞翼(圣杯)布局
最近在写页面的时候,总是为布局头疼,倒不是不能布出来,就是感觉不系统,没有成一个体系的感觉.所以决定自己写博文,梳理一下思路. 常用的布局方式大致可以分为三种: 浮动布局 Float 负边距(双飞翼) ...
- hdu2444 判断二分图+最大匹配
#include<stdio.h> #include<string.h> #include<queue> using namespace std; #define ...
- POJ2286 The Rotation Game
Description The rotation game uses a # shaped board, which can hold 24 pieces of square blocks (see ...
- 使用JMeter创建数据库(Mysql)测试
我的环境:MySQL:mysql-essential-5.1.51-win32 jdbc驱动:我已经上传到csdn上一个:http://download.csdn.net/source/3451945 ...
- OAuth2.0认证和授权原理
什么是OAuth授权? 一.什么是OAuth协议 OAuth(开放授权)是一个开放标准. 允许第三方网站在用户授权的前提下访问在用户在服务商那里存储的各种信息. 而这种授权无需将用户提供用户名和密 ...
- 字符串匹配的Boyer-Moore算法 详解 加 C# 实现
上一篇文章,我介绍了KMP算法. 但是,它并不是效率最高的算法,实际采用并不多.各种文本编辑器的"查找"功能(Ctrl+F),大多采用Boyer-Moore算法. Boyer-Mo ...