| ||||||||||
| 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 | |||||||||
2033#include <iostream>
#include <string>
using namespace std;
main(){
string s;
int a[600];
while(cin>>s&&s[0]!='0'){
int l=s.length();
int cnt=1;
a[1]=1;
a[0]=1;
for(int i=1;i<l;i++){
if(s[i]=='0') { a[i+1]=a[i-1]; }
else{
if((s[i-1]-'0')*10+s[i]-'0'<=26&&(s[i-1]-'0')*10+s[i]-'0'>=1&&s[i-1]!='0'){
a[i+1]=a[i]+a[i-1];
}
else a[i+1]=a[i];
}
}
cout<<a[l]<<endl;
}
return 1;
}
谁帮我看看?不知道问题出在哪?
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator