poj 2556 Edge 向量旋转

//poj 2556
//sep9
#include<iostream>
using namespace std;
char s[256];

int main()
{
	while(scanf("%s",&s)==1){
		int px=300,py=420;
		int x=310,y=420;
		puts("300 420 moveto
310 420 lineto");
		for(int i=0;s[i]!='';++i){
			int dx=x-px,ddx;
			int dy=y-py,ddy;
			px=x;
			py=y;
			if(s[i]=='V'){
				ddx=-dy;
				ddy=dx;	
			}else if(s[i]=='A'){
				ddx=dy;
				ddy=-dx;
			}
			x=x+ddx;
			y=y+ddy;
			printf("%d %d lineto
",x,y);	
		}
		puts("stroke
showpage");
	}
	return 0;	
} 

原文地址:https://www.cnblogs.com/gccbuaa/p/7131197.html