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

构造完了next数组后,怎么输出的呢?

Posted by 00204082 at 2003-06-03 22:06:01 on Problem 1147
我的是:
for(i=next[0];i;i=next[i]) cout<<in[i]<<' '; 
cout<<in[0]<<endl; 
//我认为最后i一定会变为0,但是wa
如果改为:
for(i=p=0;i<N;i++) 
    { 
        cout<<in[next[p]]<<" "; 
        p=next[p]; 
    } 
    cout<<endl; 
就没有问题,为什么?


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