1 //简单的dp 2 #include<cstdio> 3 #define Max(a,b) ((a)>(b)?(a):(b)) 4 int d[25]; 5 int main() 6 { 7 int i,j,n,m,x,t,te; 8 scanf("%d%d",&n,&m); 9 for(i=1; i<=n; ++i) 10 { 11 for(j=1; j<=m; ++j) 12 { 13 scanf("%d",&x); 14 d[j] = x + Max(d[j],d[j-1]); 15 } 16 } 17 printf("%d ",d[m]); 18 return 0; 19 }