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 |
不知哪里错了?求高手看一下,感激不尽!#include <iostream> #include <string> #include <fstream> using namespace std; int c[100002][100002] = {0}; int main() { //fstream cin("file"); int m,n; string s,t; int i,j; int maxval = 0; cin >> t >> s; m = s.length() - 1; n = t.length() - 1; t = ' ' + t; s = ' ' + s; for (i = 1;i <= m;i++) { for (j = 1;j <= n;j++) { if ( s[i] == t[j]) { c[i][j] = c[i - 1][j - 1] + 1; if (maxval < c[i][j]) { maxval = c[i][j]; } } } } cout << maxval + 1 << 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