Emag eht htiw Em Pleh
2016-07-26 17:34
246 查看
Emag eht htiw Em Pleh
Description
This problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input.
Input
according to output of problem 2996.
Output
according to input of problem 2996.
Sample Input
Sample Output
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
int flag[10][10];
char s[100];
void in(int t)
{
scanf("%s",s) ;
scanf("%s",s);
int l=strlen(s);
int i;
for(i=0;i<l;++i)
{
if(isupper(s[i]))
{
int y=s[i+1]-'a';
int x=s[i+2]-'0';
if(t==1)
flag[x][y]=s[i];
else flag[x][y]=tolower(s[i]);
i+=3;
continue;
}
else
if(islower(s[i]))
{
int y=s[i]-'a';
int x=s[i+1]-'0';
if(t==1)
flag[x][y]='P';
else flag[x][y]='p';
i+=2;
continue;
}
}
}
void printl()
{
printf("+---+---+---+---+---+---+---+---+\n");
}
void print()
{
int i,j;
for(i=8;i>=1;--i)
{
printl();
for(j=0;j<8;++j)
{
if((j+i)%2==0)
{
if(flag[i][j])
printf("|.%c.",flag[i][j]);
else printf("|...");
}
else
{
if(flag[i][j])
printf("|:%c:",flag[i][j]);
else printf("|:::");
}
}
printf("|\n");
}
printl();
}
int main()
{
in(1);
in(2);
print();
return 0;
}
Time Limit: 1000MS | Memory Limit: 65536K | |
Total Submissions: 3314 | Accepted: 2176 |
This problem is a reverse case of the problem 2996. You are given the output of the problem H and your task is to find the corresponding input.
Input
according to output of problem 2996.
Output
according to input of problem 2996.
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.| +---+---+---+---+---+---+---+---+
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;
int flag[10][10];
char s[100];
void in(int t)
{
scanf("%s",s) ;
scanf("%s",s);
int l=strlen(s);
int i;
for(i=0;i<l;++i)
{
if(isupper(s[i]))
{
int y=s[i+1]-'a';
int x=s[i+2]-'0';
if(t==1)
flag[x][y]=s[i];
else flag[x][y]=tolower(s[i]);
i+=3;
continue;
}
else
if(islower(s[i]))
{
int y=s[i]-'a';
int x=s[i+1]-'0';
if(t==1)
flag[x][y]='P';
else flag[x][y]='p';
i+=2;
continue;
}
}
}
void printl()
{
printf("+---+---+---+---+---+---+---+---+\n");
}
void print()
{
int i,j;
for(i=8;i>=1;--i)
{
printl();
for(j=0;j<8;++j)
{
if((j+i)%2==0)
{
if(flag[i][j])
printf("|.%c.",flag[i][j]);
else printf("|...");
}
else
{
if(flag[i][j])
printf("|:%c:",flag[i][j]);
else printf("|:::");
}
}
printf("|\n");
}
printl();
}
int main()
{
in(1);
in(2);
print();
return 0;
}
相关文章推荐
- [置顶] Spark源码解读(3)——从集群启动到Job提交
- Android自定义SurfaceView——实现画板功能
- centos discuz论坛环境搭建
- Android UI系列-----长度单位和内外边距
- 糍粑大叔的独游之旅-u3d中2D轮廓的生成(中)
- 合并(序列)流
- Android事件传递机制
- 糍粑大叔的独游之旅-u3d中2D轮廓的生成(中)
- GitHub 中国区前 100 名到底是什么样的人?
- 自定义ViewPager实现图片自动轮播无限循环
- org.apache.ibatis.builder.IncompleteElementException: Could not find result map
- IOS的PickView作为TextField事件
- "session marked for kill " 处理杀不掉的锁,立即释放会话资源
- android中xml虚线不显示,或者只显示实线
- jsp数据库基础之---从MySQL数据库中查询数据
- iOS NSDate等时间类的使用
- 面向对象设计——继承
- 转 Kafka入门经典教程
- linux内核栈与用户栈
- 实现string类