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

WA不行了

Posted by dynamic_study at 2009-07-24 22:59:45 on Problem 2033
#include<iostream>
using namespace std;
#define MAX 50000
int main()
{
	char s[MAX];
	int dp[MAX],len,i;
	while(cin>>s+1&&s[0]!='0')
	{
		len=strlen(s);
		dp[0]=1;
		dp[1]=1;
		for(i=2;i<len;i++)
		{
			if(s[i]=='0')
				dp[i]=dp[i-2];
			else if(((s[i-1]-'0')*10+s[i]-'0')>=1&&((s[i-1]-'0')*10+s[i]-'0')<=26)
				dp[i]=dp[i-1]+dp[i-2];
			else
				dp[i]=dp[i-1];
		}
		cout<<dp[len-1]<<endl;
	}
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