HDU 1033

Posted problemcutter

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 1033相关的知识,希望对你有一定的参考价值。

好久没动弹了。。动弹一下。。

题目 http://acm.hdu.edu.cn/showproblem.php?pid=1033

题意很简单,起点在(300,420),每次移动10单位,第一次向右移,给你一串字符,若为A则顺时针,为V则逆时针。

这里可以用仿射变换中的旋转变换,

于是可以大大减少代码量。

#include<cstdio>
char s[205];
int x,y,dx,dy,t,i;
int main(){
    while(scanf("%s",s)!=EOF){
        x=300;y=420;dx=10;dy=0;
        printf("%d %d moveto\\n",x,y);
        printf("%d %d lineto\\n",x+=dx,y+=dy);
        for(i=0;s[i]!=0;i++){
            if(s[i]==\'A\'){t=dy;dy=-dx;dx=t;}
            else {t=-dy;dy=dx;dx=t;}
            printf("%d %d lineto\\n",x+=dx,y+=dy);
        }
        printf("stroke\\nshowpage\\n");
    }
}

 

以上是关于HDU 1033的主要内容,如果未能解决你的问题,请参考以下文章

hdu-1033(格式)

hdu1033

hdu1033Defragment

HDU4057 Rescue the Rabbit(AC自动机+状压DP)

ZZNUOJ_C语言1033:五级制成绩(完整代码)

HDU3247 Resource Archiver(AC自动机+BFS+DP)