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

Re:2033

Posted by project at 2004-11-12 23:24:15 on Problem 2033
In 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:
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