1 #include <iostream>
2 # include <cstdio>
3 # include <cstring>
4 #include <map>
5 using namespace std;
6 char f[40][50] =
7 {
8 "",
9 " _",
10 " _/ \\_",
11 " _/ \\_/ \\_",
12 " _/ \\_/ \\_/ \\_",
13 " _/ \\_/ \\_/ \\_/ \\_",
14 "/ \\_/ \\_/ \\_/ \\_/ \\",
15 "\\_/ \\_/ \\_/ \\_/ \\_/",
16 "/ \\_/ \\_/ \\_/ \\_/ \\",
17 "\\_/ \\_/ \\_/ \\_/ \\_/",
18 "/ \\_/ \\_/ \\_/ \\_/ \\",
19 "\\_/ \\_/ \\_/ \\_/ \\_/",
20 "/ \\_/ \\_/ \\_/ \\_/ \\",
21 "\\_/ \\_/ \\_/ \\_/ \\_/",
22 "/ \\_/ \\_/ \\_/ \\_/ \\",
23 "\\_/ \\_/ \\_/ \\_/ \\_/",
24 "/ \\_/ \\_/ \\_/ \\_/ \\",
25 "\\_/ \\_/ \\_/ \\_/ \\_/",
26 "/ \\_/ \\_/ \\_/ \\_/ \\",
27 "\\_/ \\_/ \\_/ \\_/ \\_/",
28 " \\_/ \\_/ \\_/ \\_/",
29 " \\_/ \\_/ \\_/",
30 " \\_/ \\_/",
31 " \\_/",
32 };
33 int n;
34 char ch[40][40];
35 bool flag[40][40];
36 char se, mark;
37 int pos;
38 int x, y;
39 int num[10]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
40 map<char, int>m;
41 void init()
42 {
43 m['A']=1; m['B'] = 3; m['C'] = 5;
44 m['D']=7; m['E']=9; m['F']=11;
45 m['G'] = 13; m['H'] = 15;
46 m['I'] = 17;
47 }
48 int main()
49 {
50 int i, j;
51 init();
52 while(scanf("%d",&n)!=EOF && n)
53 {
54 memset(flag, false, sizeof(flag));
55 for (int i=1;i<=n; i++)
56 {
57 getchar();
58 scanf("%c%d %c",&se, &pos, &mark);
59 x = m[se];
60 int t = num[se-'A'+1];
61 switch(t)
62 {
63 case 1: y=2*(8-pos)+2; break;
64 case 2: y=2*(8-pos)+3; break;
65 case 3: y=2*(9-pos)+2; break;
66 case 4: y=2*(9-pos)+3; break;
67 case 5: y=2*(10-pos)+2; break;
68 case 6: y=2*(9-pos)+3; break;
69 case 7: y=2*(9-pos)+2; break;
70 case 8: y=2*(8-pos)+3; break;
71 case 9: y=2*(8-pos)+2; break;
72 }
73 flag[y][x] = true;
74 ch[y][x] = mark;
75 }
76 for (i=1; i<=23; i++)
77 {
78 for (j=0; j<strlen(f[i]); j++)
79 {
80 if(flag[i][j])
81 {
82 printf("%c", ch[i][j]);
83 }
84 else
85 {
86 printf("%c", f[i][j]);
87 }
88 }
89 printf("\n");
90 }
91 }
92 return 0;
93 }
好吧,没什么好说的,定位棋盘上的棋子,直接贴代码了。感觉好多时候比赛时这种题目没有做,好亏好亏。
,