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 |
请问,下面代码为什么会Runtime Error ?#include "stdio.h" char str[5002]; int length; short f[5002][5002]; void dp() { int i,j; for(i = length - 2; i >= 0; i--) { for(j = i + 1; j < length; j++) { if(str[i] == str[j]){ f[i][j] = f[i+1][j-1]; } else { if(f[i+1][j] < f[i][j-1]) f[i][j] = f[i+1][j] + 1; else f[i][j] = f[i][j-1] + 1; } } } } int main() { scanf("%d",&length); scanf("%s",str); dp(); printf(f[0][length-1]); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator