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 zheng at 2006-10-01 13:55:49 on Problem 2556
#include<stdio.h>
#include<string.h>
void main()
{
	char a[201];
	while(scanf("%s",a))
	{
		printf("300 420 moveto\n310 420 lineto\n");
		int i,m=310,n=420,flag1=0,flag2=1;//flag1=1 meaning last change is n,or m;
		for(i=0;i<strlen(a);i++)         //flag2=1 meaning add;
		{
			if(a[i]=='A')
			{
				if(flag1==1&&flag2==1)
				{
					m=m+10;
					flag1=0;
					//if(n>=420&&m>=300)
					printf("%d %d lineto\n",m,n);
					continue;
				}
				else if(flag1==1&&flag2==0)
				{
					m=m-10;
					flag1=0;
				//	if(n>=420&&m>=300)
					printf("%d %d lineto\n",m,n);
					continue;
				}
				else if(flag2==0)
				{
					n=n+10;
					flag2=1;
					flag1=1;
					//if(n>=420&&m>=300)
						printf("%d %d lineto\n",m,n);
					continue;
				}
				else if(flag2==1)
				{
					n=n-10;
					flag2=0;
					flag1=1;
					//if(n>=420&&m>=300)
						printf("%d %d lineto\n",m,n);
				}
				
				
			}
			if(a[i]=='V')
			{
				if(flag1==1&&flag2==1)
				{
					m=m-10;
					flag1=0;
					flag2=0;
					//if(m>=300&&n>=420)
						printf("%d %d lineto\n",m,n);
					continue;
				}
				else if(flag1==1&&flag2==0)
				{
					m=m+10;
					flag1=0;
					//if(m>=300&&n>=420)
					printf("%d %d lineto\n",m,n);
					continue;
				}
				else if(flag2==0)
				{
					n=n-10;
					flag1=1;
					//if(n>=420&&m>=300)
						printf("%d %d lineto\n",m,n);
					continue;
				}
				else if(flag2==1)
				{
					n=n+10;
					flag1=1;
					//if(n>=420&&m>=300)
						printf("%d %d lineto\n",m,n);
				}
				
			}
		}
		printf("stroke\nshowpage\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