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 ...
随机推荐
- [USACO2002][poj1945]Power Hungry Cows(启发式搜索)
Power Hungry CowsTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 4570 Accepted: 1120 Desc ...
- Coding the Matrix (2):向量空间
1. 线性组合 概念很简单: 当然,这里向量前面的系数都是标量. 2. Span 向量v1,v2,.... ,vn的所有线性组合构成的集合,称为v1,v2,... ,vn的张成(span).向量v1, ...
- 百度地图 api 功能封装类 (ZMap.js) 本地搜索,范围查找实例 [源码下载]
相关说明 1. 界面查看: 吐槽贴:百度地图 api 封装 的实用功能 [源码下载] 2. 功能说明: 百度地图整合功能分享修正版[ZMap.js] 实例源码! ZMap.js 本类方法功能大多使用 ...
- 第八章:Javascript函数
函数是这样一段代码,它只定义一次,但可能被执行或调用任意次.你可能从诸如子例程(subroutine)或者过程(procedure)这些名字里对函数概念有所了解. javascript函数是参数化的: ...
- “耐撕”团队 2016.04.07 站立会议
1. 时间: 20:00--20:15 共计20分钟. 2. 成员: Z 郑蕊 * 组长 (博客:http://www.cnblogs.com/zhengrui0452/), P 濮成林(博客:ht ...
- 使用 ArcGIS中的ArcObjects进行二次开发
参考网址:https://blogs.esri.com/esri/arcgis/2012/12/07/arcobjects-or-runtime-sdk/ http://resources.arcgi ...
- java.lang.NoClassDefFoundError: antlr/ANTLRException
在用Hibernate进行查询时,出现这样的错误:Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ ...
- 视频播放实时记录日志并生成XML文件
需求描述: 在JWPlayer视频播放过程中,要求实时记录视频观看者播放.暂停的时间,并记录从暂停到下一次播放时所经过的时间.将所有记录保存为XML文件,以方便数据库的后续使用. 实现过程: 尝试1: ...
- 反射工具类——ReflectUtils
测试方法:根据已知的方法名,来反射调用方法 package com.redmoon.forum.job; import java.util.ArrayList; import java.util.Li ...
- java获取每个月的最后一天
package timeUtil; import java.text.SimpleDateFormat; import java.util.Calendar; public class LastDay ...