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 |
求解脱啊!!!!!!!!!!!!!!!11到底哪错了啊!!!!!!!!!!跪求解释啊# include<stdio.h> # include<memory.h> short dp[2][5000],i,j,len; char a[5000]; main() { scanf("%d %s",&len,a); memset(dp,0,sizeof(dp)); for(i=1;i<=len;i++) for(j=1;j<=len;j++) { if(a[i-1]==a[len-j]) dp[i%2][j]=dp[(i-1)%2][j-1]+1; else dp[i%2][j]=(dp[(i-1)%2][j]>dp[i%2][j-1]?dp[(i-1)%2][j]:dp[i%2][j-1]); } printf("%d\n",len-dp[len%2][len]); } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator