| ||||||||||
| 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 | |||||||||
字符串数组不够大,死循环In Reply To:hawk大哥能不能给解释一下 Posted by:tencent at 2005-04-29 16:47:56 > 这种题竟会超时??
> 可原代码没看出有问题啊??
>
> #include<iostream.h>
>
> void main()
> {
> char a[10000],b[10000];
> int i,j,iftrue;
> while(cin>>a>>b)
> {
> i=0;j=0;
> while(a[i] != '\0')
> {
> iftrue=0;
> while(b[j] != '\0')
> {
> if(a[i] == b[j])
> {
> i++;
> j++;
> iftrue=1;
> break;
> }
> else j++;
> }
> if(iftrue==0)
> {
> cout<<"No"<<endl;
> break;
> }
> }
> if(a[i] == '\0')
> cout<<"Yes"<<endl;
> }
> }
>
>
>
>
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator