因为之前坐过二维dp(后来才知道这其实叫序列dp)的题,所以看到这个题还是有一些思路的,但是这个题的关键点在于初始化,一定要初始化非法状态,不能一上来就初始化全为0这题还是有收获的不过还是那句话,菜就多练 #include <bits/stdc++.h> using namespace std; int main(int argc, char const* argv[]) { int n = 0, m = 0; cin >> n >> m; int a[n] = {0}; for (int i = 0; i <...