hdu_1033(我怎么找到的这么水的题,只为保存代码。。。)

 #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int Max = ;
int ansx[Max],ansy[Max];
//0,1,2,3表示方向,顺时针标注
void ans(int tx,int ty, int dir,int id)
{
if(dir == ){
ansx[id+] = tx+;
ansy[id+] = ty;
}
else if(dir == ){
ansx[id+] = tx;
ansy[id+] = ty+;
}
else if(dir == ){
ansx[id+] = tx-;
ansy[id+] = ty;
}
else if(dir == ){
ansx[id+] = tx;
ansy[id+] = ty-;
}
}
int main()
{
int dir = ;
char query[Max];
while(~scanf("%s",query))
{
dir = ;
ansx[] = ,ansy[] = ;
int len = strlen(query);
for(int i = ; i < len; i++)
{
if(query[i]=='V') {
dir = (dir+)%;
ans(ansx[i],ansy[i],dir,i);
}
else if(query[i]=='A'){
dir = (dir+)%;
ans(ansx[i],ansy[i],dir,i);
}
}
printf("300 420 moveto\n");
for(int i = ; i <= len; i++){
printf("%d %d lineto\n",ansx[i],ansy[i]);
}
printf("stroke\nshowpage\n");
}
return ;
}
上一篇:手把手教你在VMware虚拟机中安装Ubuntu14.04系统


下一篇:[bzoj1059] [ZJOI2007] 矩阵游戏 (二分图匹配)