7 条题解

  • 1
    @ 2025-6-13 13:03:41
    /****************************************
    Note:
    ****************************************/
    #include <queue>
    #include <math.h>
    #include <stack>
    #include <vector>
    #include <stdio.h>
    #include <iostream>
    #include <vector>
    #include <iomanip>
    #include <string.h>
    #include <cstring>
    #include <algorithm>
    #define int long long
    using namespace std;
    const int N = 1e6 + 10;
    const int INF = 0x3f3f3f3f;
    int n;
    int dp[1010][1010],num[1010][1010];
    int maxx;
    signed main(){
    	cin >> n;
    	while(n--){
    		int r,c;
    		cin >> r >> c;
    		for(int i=1;i<=r;i++)
    			for(int j=1;j<=c;j++)
    				cin >> num[i][j];
    		for(int i=1;i<=r;i++)
    			for(int j=1;j<=c;j++)
    				num[i][j] += max(num[i-1][j],num[i][j-1]);
    		cout << num[r][c] << endl;
    	}
    	return 0;
    }
    
    

    `

    信息

    ID
    1341
    时间
    1000ms
    内存
    256MiB
    难度
    5
    标签
    递交数
    318
    已通过
    132
    上传者