改了一下,还是不对啊。。。
```cpp
#include<bits/stdc++.h>
using namespace std;
int a[2005][2005]={};
int f[2005][2005]={};
int main(){
//freopen("1.txt","r",stdin);
int n,m;
cin>>m>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>a[i][j];
}
}
f[0][0]=0;
f[0][1]=0;
f[1][0]=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
f[i][j]=f[i][j]+a[i][j]+min(f[1][j-1],min(f[i][j-1],f[i-1][j-1]));
}
}
// printf("\n\n");
// for(int i=1;i<=n;i++){
// for(int j=1;j<=m;j++){
// cout<<f[i][j]<<" ";
// }
// printf("\n");
// }
cout<<f[n][m]<<"\n";
// system("pause");
return 0;
}
```
by _WuHu_ @ 2022-07-19 22:13:27
$f_{n,m}$ 不一定是最优答案,任何一个小组都有可能会出现最优解
by DreamFox @ 2022-07-19 22:33:03
@[crp_cpp](/user/237940) 哦,谢谢,我试试
by _WuHu_ @ 2022-07-20 19:42:05