zoukankan      html  css  js  c++  java
  • HDU 1033 Edge

    转载请注明出处:http://blog.csdn.net/a1dark

    分析:一道简单的模拟题、就是题目英文有点长、各种蛋疼、让你V和A分别逆时针旋转和顺时针旋转、然后输出转过之后的坐标就OK了、

    #include<stdio.h>
    #include<string.h>
    #include<stdio.h>
    #include<iostream>
    using namespace std;
    char st[205];
    int flag,x,y;
    void move(int &x,int &y,int &flag,char dict){
        if(flag==0){
            if(dict=='A'){
                x=x+10;
                y=y;
                flag=1;
            }
            else{
                x=x-10;
                y=y;
                flag=3;
            }
        }
        else if(flag==1){
            if(dict=='A'){
                x=x;
                y=y-10;
                flag=2;
            }
            else{
                x=x;
                y=y+10;
                flag=0;
            }
        }
        else if(flag==2){
            if(dict=='A'){
                x=x-10;
                y=y;
                flag=3;
            }
            else{
                x=x+10;
                y=y;
                flag=1;
            }
        }
        else{
            if(dict=='A'){
                x=x;
                y=y+10;
                flag=0;
            }
            else{
                x=x;
                y=y-10;
                flag=2;
            }
        }
    }
    int main(){
        while(scanf("%s",&st)!=EOF){
            printf("300 420 moveto
    310 420 lineto
    ");
            int len=strlen(st);
            flag=1;
            int i;
            x=310;y=420;
            for(i=0;i<len;i++){
                move(x,y,flag,st[i]);
                printf("%d %d lineto
    ",x,y);
            }
            printf("stroke
    showpage
    ");
        }
        return 0;
    }


  • 相关阅读:
    简单手风琴特效、轮播
    MVC
    文字自动下拉隐藏显示
    jQuery基础 DOM操作
    JQuery基础
    SQL 中的常用函数及使用
    数据库中的T-sql语句 条件修改 高级查询
    2017-03-09 数据库的基本东西
    C#中的冒泡排序
    C#中的数组
  • 原文地址:https://www.cnblogs.com/pangblog/p/3301794.html
Copyright © 2011-2022 走看看