并没有很快的想到转移方程,所以就直接搜索吧。(写起来超短的) int dfs(int cur, int l) { if (cur == n + 1) return 0; if (memo[cur][l] != 0) return memo[cur][l]; return memo[cur][l] = max(dfs(cur + 1, l) + a[n - cur + l] * b[cur], dfs(cur + 1, l + 1) + a[l] * b[cur]); } void solve() { memset(memo, 0, sizeof memo); ...