POJ 2996 Help Me with the Game
来源:互联网 发布:机械制图用什么软件 编辑:程序博客网 时间:2024/04/25 22:24
模拟题哇。。
注意一下,白棋先按行数(棋盘的行编号)升序排,然后按照列升序排。
黑棋先按行数(棋盘的编号)降序排,然后按照列升序排。
#include <iostream>#include <cstdio>#include <cstring>using namespace std;bool f;char a[17][33];void find1(char c){ int i,j,q,w; f=false; for (i=15,q=8; i>=1; i-=2,q--) { for (j=2,w=0; j<33; j+=4,w++) { if (a[i][j] == c) { if (c == 'P' || c == 'p') { if (f == true) { printf(","); } else f=true; printf("%c%d",'a'+w,9-q); } else { printf("%c%c%d,",c,'a'+w,9-q); } } } }}void find2(char c){ int i,j,q,w; f=false; for (i=1,q=1; i<17; i+=2,q++) { for (j=2,w=0; j<33; j+=4,w++) { if (a[i][j] == c) { if (c == 'P' || c == 'p') { if (f == true) { printf(","); } else f=true; printf("%c%d",'a'+w,9-q); } else { printf("%c%c%d,",c-32,'a'+w,9-q); } } } }}int main(){ int i,j; for (i=0; i<17; i++) gets(a[i]); printf("White: "); find1('K'); find1('Q'); find1('R'); find1('B'); find1('N'); find1('P'); printf("\n"); printf("Black: "); find2('k'); find2('q'); find2('r'); find2('b'); find2('n'); find2('p'); printf("\n");}
- 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
- 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
- poj 2996 Help Me with the Game
- POJ-2996-Help Me with the Game
- poj 2996 Help Me with the Game
- shell: ar命令选项解释
- Android数据的四种存储方式SharedPreferences、SQLite、Content Provider和File (四) —— ContentProvider
- 组织/公司架构图 对法国和中国彻底膜拜了
- (游戏及源代码)C#拼图游戏
- 解决win7英文版下中文显示乱码问题
- POJ 2996 Help Me with the Game
- 【自绘Button之一】带Icon的按钮控件
- 互联网协议入门
- makefile: 规则、函数、符号说明
- Android 布局相关
- LeetCode 3Sum
- javascript基础教程
- 捉蒋敢死队揭秘:1949年蒋介石惊险逃离大陆
- ubuntu中的VI编辑器按i进入文本编辑模式,按上下左右键显示ABCD字母