Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

牛人们,帮忙看个程序吧...

Posted by jiabiao at 2005-08-28 21:09:29 on Problem 2556
#include<stdio.h>
void main()
{
  char str[200];
  int i,m=310,n=420,x,y;
  while(scanf("%s",str)!=EOF)
  {
     printf("300 420 moveto\n");
	 printf("310 420 lineto\n");
	 m=310;n=420;
     for(i=0;str[i];i++)
	 {
        if(str[i]=='V')
		{
			if((m+n)%20==0)
			{
			   if(n>420)
			   {
                 x=m-10;y=n;
			     printf("%d %d lineto\n",x,n);
			   }
			   if(n<420)
			   {
				 x=m+10;y=n;
			     printf("%d %d lineto\n",x,n);
			   }
			}
			if((m+n)%20!=0)
			{
				y=n+10;x=m;
			  printf("%d %d lineto\n",m,y);
			}
			m=x;n=y;
		}
		if(str[i]=='A')
		{
		   if((m+n)%20==0)
		   {
             if(n>420)
			 {
				 x=m+10;y=n;
                printf("%d %d lineto\n",x,n);		
			 }
		     if(n<420)
			 {
				 x=m-10;y=n;
			    printf("%d %d lineto\n",x,n);
			 }
		   }
		   if((m+n)%20!=0)
		   {
			   y=n-10;x=m;
              printf("%d %d lineto\n",m,y); 
		   }
		   m=x;n=y;
		}
	 }
	 printf("stroke\n");
	 printf("showpage\n");
  } 
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator