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

Re:到底输出是怎样的啊?

Posted by liuwb at 2007-06-08 12:29:17 on Problem 2608
In Reply To:到底输出是怎样的啊? Posted by:liuwb at 2007-06-08 12:28:43
这个程序有问题么?老是WA

#include <stdio.h>
char letter[25];
int a[]={-1,1,2,3,-1,1,2,-1,-1,2,2,4,5,5,-1,1,2,6,2,3,-1,1,-1,2,-1,2};
int main(int argc, char* argv[])
{
	char *p;
	int last=-1;
	while(scanf("%s",letter)!=EOF){
		p=letter;
		while (*p) {
			if( a[*p-'A']>0 ){
				if(a[*p-'A']!=last)
				{
					printf("%d",a[*p-'A']);
					last=a[*p-'A'];
				}
			}else{
				last=-1;
			}
			++p;
		}
		printf("\n");
	}
	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