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:构造完了next数组后,怎么输出的呢?In Reply To:构造完了next数组后,怎么输出的呢? Posted by:00204082 at 2003-06-03 22:06:01 > 我的是: > 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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator