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 dingdongsheng at 2008-09-30 21:07:54 on Problem 2033
#include<stdio.h>
#include<string.h>
void main()
{
	long i,len;
	char s[50000];
	long a[50009];
	
	
	while(scanf("%s",s),strcmp(s,"0"))
	{
		len=strlen(s);
		for(i=1;i<len;i++)
		{
			a[0]=1;
			a[1]=1;
			int temp;
			temp=(s[i-1]-'0')*10+s[i]-'0';
            if(s[i]=='0')
			    a[i+1]=a[i];
			else if(temp>26)
				a[i+1]=a[i];
			else if(temp<10)
				a[i+1]=a[i-1];
			else
				a[i+1]=a[i]+a[i-1];
		}
		printf("%ld\n",a[i]);
	}
}

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