Emag eht htiw Em Pleh(模拟法)
来源:互联网 发布:python urlencode gbk 编辑:程序博客网 时间:2024/06/05 12:43
Emag eht htiw Em Pleh
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3424 Accepted: 2249
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
White: Ke1,Qd1,Ra1,Rh1,Bc1,Bf1,Nb1,a2,c2,d2,f2,g2,h2,a3,e4Black: 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
CTU Open 2005
解题报告:这是一道模拟题,以国际象棋为背景,给我们分别描述白棋和黑棋的位置,让我们在固定的格式中填充,我们首先把图表打出来(在没有白棋和黑棋的情况下),在根据所给的信息,填充即可,剩下的就是找规律了
#include <iostream>#include <cstring>#include <cstdio>using namespace std; string w1,w,b1,b;//白色是大写char mp[100][100]={ "+---+---+---+---+---+---+---+---+", "|...|:::|...|:::|...|:::|...|:::|", "+---+---+---+---+---+---+---+---+", "|:::|...|:::|...|:::|...|:::|...|", "+---+---+---+---+---+---+---+---+", "|...|:::|...|:::|...|:::|...|:::|", "+---+---+---+---+---+---+---+---+", "|:::|...|:::|...|:::|...|:::|...|", "+---+---+---+---+---+---+---+---+", "|...|:::|...|:::|...|:::|...|:::|", "+---+---+---+---+---+---+---+---+", "|:::|...|:::|...|:::|...|:::|...|", "+---+---+---+---+---+---+---+---+", "|...|:::|...|:::|...|:::|...|:.:|", "+---+---+---+---+---+---+---+---+", "|:::|...|:::|...|:::|...|:::|...|", "+---+---+---+---+---+---+---+---+"};void chuliw(){ int i; int x,y;//找出横纵坐标的规律,进行替换 char c; for(i=0;w[i];i++) { switch(w[i]) { case 'K': c='K'; i++; y=(w[i]-'a'+1)*4-2; i++; x=(17-2*(w[i]-'0')); mp[x][y]=c; break; case 'Q': c='Q'; i++; y=(w[i]-'a'+1)*4-2; i++; x=(17-2*(w[i]-'0')); mp[x][y]=c; break; case 'R': c='R'; i++; y=(w[i]-'a'+1)*4-2; i++; x=(17-2*(w[i]-'0')); mp[x][y]=c; break; case 'B': c='B'; i++; y=(w[i]-'a'+1)*4-2; i++; x=(17-2*(w[i]-'0')); mp[x][y]=c; break; case 'N': c='N'; i++; y=(w[i]-'a'+1)*4-2; i++; x=(17-2*(w[i]-'0')); mp[x][y]=c; break; } if('a'<=w[i]&&w[i]<='z') { c='P'; y=(w[i]-'a'+1)*4-2; i++; x=(17-2*(w[i]-'0')); mp[x][y]=c; } }}void chulib(){ int i; int x,y; char c; for(i=0;b[i];i++) { switch(b[i]) { case 'K': c='k'; i++; y=(b[i]-'a'+1)*4-2; i++; x=(17-2*(b[i]-'0')); mp[x][y]=c; break; case 'Q': c='q'; i++; y=(b[i]-'a'+1)*4-2; i++; x=(17-2*(b[i]-'0')); mp[x][y]=c; break; case 'R': c='r'; i++; y=(b[i]-'a'+1)*4-2; i++; x=(17-2*(b[i]-'0')); mp[x][y]=c; break; case 'B': c='b'; i++; y=(b[i]-'a'+1)*4-2; i++; x=(17-2*(b[i]-'0')); mp[x][y]=c; break; case 'N': c='n'; i++; y=(b[i]-'a'+1)*4-2; i++; x=(17-2*(b[i]-'0')); mp[x][y]=c; break; } if('a'<=b[i]&&b[i]<='z') { c='p'; y=(b[i]-'a'+1)*4-2; i++; x=(17-2*(b[i]-'0')); mp[x][y]=c; } }}int main(){ int i,j; cin>>w1>>w>>b1>>b; chuliw(); chulib(); for(i=0;i<17;i++) { for(j=0;j<33;j++) { cout<<mp[i][j]; } cout<<endl; } return 0;}
0 0
- Emag eht htiw Em Pleh(模拟法)
- Emag eht htiw Em Pleh
- Emag eht htiw Em Pleh
- Emag eht htiw Em Pleh
- Emag eht htiw Em Pleh
- Emag eht htiw Em Pleh
- POJ2993《Emag eht htiw Em Pleh》方法:模拟
- POJ 2993 Emag eht htiw Em Pleh【模拟画棋盘】
- Emag eht htiw Em Pleh(poj1999模拟)
- POJ 2993 Emag eht htiw Em Pleh 大模拟
- 棋盘模拟——Emag eht htiw Em Pleh
- POJ 2993:Emag eht htiw Em Pleh:模拟题
- POJ 2993Emag eht htiw Em Pleh(模拟)
- POJ 2993 Emag eht htiw Em Pleh 模拟
- poj 2993 Emag eht htiw Em Pleh(模拟)
- POJ 2993-Emag eht htiw Em Pleh(模拟)
- POJ 2993 Emag eht htiw Em Pleh(模拟)
- poj_2993 Emag eht htiw Em Pleh(模拟)
- Android 手机欢迎界面不显示图片的问题
- Shell基本命令([记住]一个man搞定所有)
- javafx之TableView的TaleCell
- 生成与使用静态库/动态库
- mongodb的安装命令
- Emag eht htiw Em Pleh(模拟法)
- UVA 11462 Age Sort 计数排序 .
- Java-面向对象(高级篇)--instanceof关键字
- 【openjudge】河中跳房子 二分查找
- 轮播图点击跳转
- 总结14
- 欢迎使用CSDN-markdown编辑器
- 求树的重心
- JavaFX之TableView的TableRow