📄 2283.cpp
字号:
/* This Code is Submitted by wywcgs for Problem 2283 on 2006-06-18 at 23:02:12 */
#include <cstdio>
#include <cctype>
#include <algorithm>
using namespace std;
const char P[][8] = { "KQRBNP", "kqrbnp" };
const char BLK[] = ".:";
const char SEP[] = "+---+---+---+---+---+---+---+---+\n";
int main()
{
int i, j, board[8][8];
char line[64];
while(true) {
memset(board, -1, sizeof(board));
for(i = 0; i < 2; i++) {
if(scanf("\n%s", line) == EOF) return 0;
while(getchar() != '\n') {
char s[4], cp = 'P'; scanf("%[A-Za-z0-9]s", s);
int idx = (s[2]!=0)?1:0, c = s[idx++]-'a', r = s[idx++]-'1', o;
if(isupper(s[0])) cp = s[0];
for(o = 0; cp != P[0][o]; o++) ;
board[7-r][c] = (o<<1)|i;
}
}
printf(SEP);
for(i = 0; i < 8; i++) {
for(j = 0; j < 8; j++) {
int spc = BLK[(i+j)&1], v = board[i][j];
printf("|%c%c%c", spc, (v==-1)?spc:P[v&1][v>>1], spc);
}
printf("|\n%s", SEP);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -