Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
WA不行了#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator