#include char screen[76][76]; int s_x, s_y; int i, j; void swap_x(int *x1, int *y1, int *x2, int *y2){ int tx; if (*x1>*x2){ tx=*x1; *x1=*x2; *x2=tx; tx=*y1; *y1=*y2; *y2=tx; } } void print(){ printf("+"); for (i=0; i=y2; j--){ screen[i][j]=' '; } } } void point(){ int x, y; scanf("%d %d\n", &x, &y); if (x<0 || x>s_x || y<0 || y>s_y) return; if (screen[x][y]==' ' || screen[x][y]=='o') screen[x][y]='o'; else screen[x][y]='*'; } void text(){ char t[200]; int x, y; scanf("%d %d %s\n", &x, &y, t); if (y<0 && y>s_y) return; for (i=0; i0 && (x+i)0 && x1<=s_x)){ if (y1>y2){ inc*=-1; y2--; } else y2++; for (i=y1; i!=y2; i+=inc){ if (y1<1 || y1>s_y) continue; if (screen[x1][i]==' ' || screen[x1][i]=='|') screen[x1][i]='|'; else if (screen[x1][i]=='-' || screen[x1][i]=='+') screen[x1][i]='+'; else screen[x1][i]='*'; } } else if (y1==y2 && (y1>0 && y1<=s_y)){ if (x1>x2){ x2--; inc*=-1; } else { x2++; } for (i=x1; i!=x2; i+=inc){ if (x1<1 || x1>s_x) continue; if (screen[i][y1]==' ' || screen[i][y1]=='-') screen[i][y1]='-'; else if (screen[i][y1]=='|' || screen[i][y1]=='+') screen[i][y1]='+'; else screen[i][y1]='*'; } } else if (y1s_x || (y1+i)<0 || y1+i>s_y) continue; if (screen[x1+i][y1+i]==' ' || screen[x1+i][y1+i]=='\\') screen[x1+i][y1+i]='\\'; else if (screen[x1+i][y1+i]=='/') screen[x1+i][y1+i]='x'; else screen[x1+i][y1+i]='*'; } } else { for (i=0; i<=y1-y2; i++){ if ((x1+i)<0 || (x1+i)>s_x || (y1-i)<0 || y1-i>s_y) continue; if (screen[x1+i][y1-i]==' ' || screen[x1+i][y1-i]=='/') screen[x1+i][y1-i]='/'; else if (screen[x1+i][y1-i]=='\\') screen[x1+i][y1-i]='x'; else screen[x1+i][y1-i]='*'; } } } int main(void){ char s[20]; scanf("%d %d\n", &s_x, &s_y); clear_all(); while(s_x!=0 && s_y!=0){ while (1){ scanf("%s ", s); if (s[0]=='L') line(); else if (s[0]=='T') text(); else if (s[0]=='C') clear(); else if (s[1]=='O') point(); else if (s[1]=='R'){ print(); break; } } scanf("%d %d\n", &s_x, &s_y); clear_all(); } return 0; }