| ||||||||||
| 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:过路的大哥大姐,为什么老是run time error???In Reply To:过路的大哥大姐,为什么老是run time error??? Posted by:suying at 2009-04-03 23:19:22 数组开小了呗
> {
> char a[100],b[100];
> //string a,b;
> int lena,lenb,i,j;
> int array[100][100];
> while(cin>>lena>>a>>lenb>>b)
> {
>
>
> for(i=0;i<=lena;i++)
> array[i][0]=i;
> for(i=0;i<=lenb;i++)
> array[0][i]=i;
> for(i=1;i<=lena;i++)
> {
> for(j=1;j<=lenb;j++)
> {
> if(a[i-1]==b[j-1])
> {
> array[i][j]=min(array[i-1][j-1],array[i-1][j]+1,array[i][j-1]+1);
> }
> else
> {
> array[i][j]=min(array[i-1][j-1]+1,array[i-1][j]+1,array[i][j-1]+1);
> }
> }
> }
> cout<<array[lena][lenb]<<endl;
> }
> return 0;
> }
>
>
>
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator