2012年1月26日

USACO 5.1 music theme

摘要: 很容易注意到:对原序列相邻两项做差(x[i]-x[i-1]),然后题目要求就变成了球最长重复子串。。听说可以用后缀数组,orz。。还不会= =,偶用的傻傻的DP。。dp[i][j] (i<j)=max(1, min(dp[i-1][j-1]+1 (if num[i]==num[j]), j-i));/*ID: zlqest11LANG: C++TASK: theme*/#include <iostream>#include <cstdio>#include <cstring>using namespace std;const int N = 5010; 阅读全文

posted @ 2012-01-26 21:00 Moon_1st 阅读(288) 评论(0) 推荐(0) 编辑

导航