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

求助啊!编写我觉得应该是对的,自己运行的结果也是对的,他就是不AC ,求牛人指教!

Posted by 327813273 at 2011-01-13 11:12:16 on Problem 1028
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
struct choice
{
	char chance[10];
};
typedef struct choice choice;
int main()
{
	char stack[100][100]={0},input[100][100],s[10],begin[]={"http://www.acm.org/"},sign[10]={0};
	choice ch[100]={0};
	int i,j=0,k=1,index=0;

	strcpy(stack[0],begin);

	for(i=0;;i++)
	{
	   scanf("%s",s);
	   index++;
	   strcpy(ch[i].chance,s);
	   if(strcmp(s,"VISIT")==0)
	   {	 
		   //getchar();
		  // printf("请输入:");
		   scanf("%s",input[j]);
		   j++;k++;
	   }
	   if(strcmp(s,"QUIT")==0)
		   break;
	   index++;
	}

   k=0;j=0;

	for(i=0;i<index;i++)
	{
		if(strcmp(ch[i].chance,"VISIT")==0)
		{
			k++;
			strcpy(stack[k],input[j]);
			j++;
            printf("%s\n",stack[k]);
			
		}
		else if(strcmp(ch[i].chance,"BACK")==0)
		{
			k--;
			if(k<0)
			{
				printf("Ignored\n");
				k++;
			}
			else
				printf("%s\n",stack[k]);
		}
		else if(strcmp(ch[i].chance,"FORWARD")==0)
		{
			k++;
			if(strcmp(stack[k],sign)==0)
			{
				printf("Ignored\n");
				k--;
			}
			else
				printf("%s\n",stack[k]);
		}
		else if(strcmp(ch[i].chance,"QIUT")==0)
			break;
	}
	return 0;
}


			

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