深搜+剪枝,简单字符串。
1 #include2 #include 3 4 #define MAXLEN 105 5 #define MAXNUM 105 6 7 char buf[MAXNUM][MAXLEN]; 8 char src1[MAXLEN], src2[MAXLEN]; 9 int case_n, n;10 11 int f(int index, int len) {12 int max = 0;13 int i=0, j, k;14 char *p;15 16 while (i+max < len) {17 for (j=0; j<=max; ++j)18 src1[j] = src2[max-j] = buf[index][i+j];19 src1[max+1] = src2[max+1] = '\0';20 k = 1;21 for (j=0; j