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 |
Re:2033In Reply To:2033 Posted by:yzg_1984 at 2004-11-12 19:54:45 数组开得不够大 > #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