题意不好理解,但理解之后就很简单啦
#include<cstdio>
char ope[300];
int main(){
int i,x,y,dis;
char dir;
while(scanf("%s",ope)!=EOF){
i=0;
printf("300 420 moveto\n310 420 lineto\n");
x=310;
y=420;
dir='x';dis=10;
while(ope[i]!='\0'){
if(ope[i]=='A'){
if(dir=='x'){
dis=-dis;
dir='y';
y+=dis;
}else{
dir='x';
x+=dis;
}
}else{
if(dir=='x'){
dir='y';
y+=dis;
}else{
dis=-dis;
dir='x';
x+=dis;
}
}
printf("%d %d lineto\n",x,y);
i++;
}
printf("stroke\nshowpage\n");
}
}