Emag eht htiw Em Pleh(POJ 2993)、Help Me with the Game(POJ 2996)模拟题
2013-08-07 16:10
381 查看
Emag eht htiw Em Pleh(POJ 2993)
~题目链接~
http://poj.org/problem?id=2993
输入
结果
View Code
~题目链接~
http://poj.org/problem?id=2993
输入
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
结果
+---+---+---+---+---+---+---+---+ |.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.| +---+---+---+---+---+---+---+---+ 图示:white:大写字母,顺序从下往上 black:小写字母,顺序从上往下
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> int flag; char s[40],map[8][8]; void find1(char str) { for(int i=7; i>=0; i--) for(int j=0; j<8; j++) if(map[i][j]==str) { if(!flag) flag=1; else printf(","); if(str!='P') printf("%c",str); printf("%c%d",j+'a',8-i); } } void find2(char str) { for(int i=0; i<8; i++) for(int j=0; j<8; j++) if(map[i][j]==str) { if(!flag) flag=1; else printf(","); if(str!='p') printf("%c",toupper(str)); printf("%c%d",j+'a',8-i); } } int main() { gets(s); for(int i=0; i<8; i++) { gets(s); for(int j=0; j<8; j++) { if(isalpha(s[4*(j+1)-2])) map[i][j]=s[4*(j+1)-2]; } gets(s); } flag=0; printf("White: "); find1('K');find1('Q');find1('R');find1('B');find1('N');find1('P'); printf("\n"); flag=0; printf("Black: "); find2('k');find2('q');find2('r');find2('b');find2('n');find2('p'); printf("\n"); return 0; }
View Code
相关文章推荐
- poj-2993-Emag eht htiw Em Pleh && poj-2996-Help Me with the Game
- poj-2996-2993-Help Me with the Game-模拟法
- POJ2993——Emag eht htiw Em Pleh(模拟题)
- POJ 2996:Help Me with the Game 模拟题
- POJ 2993:Emag eht htiw Em Pleh:模拟题
- poj 2993 Emag eht htiw Em Pleh(关联2996)
- POJ2993,Emag eht htiw Em Pleh,跟2996反过来
- POJ 2993 Emag eht htiw Em Pleh(模拟)
- POJ 2996:Help Me with the Game
- POJ 2996-Help Me with the Game(模拟)
- Poj 2996 Help Me with the Game
- poj 2996 Help Me with the Game
- 模拟 POJ 2996 Help Me with the Game
- poj 2996 Help Me with the Game
- poj 2996 Help Me with the Game 模拟
- POJ 2996 Help Me with the Game(模拟)
- Help Me with the Game(POJ--2996
- POJ 2996 Help Me with the Game 国际象棋,模拟
- 快速切题 poj 2996 Help Me with the Game 棋盘 模拟 暴力 难度:0
- poj 2996 Help Me with the Game 模拟