AcWing
  • 首页
  • 题库
  • 题解
  • 分享
  • 问答
  • 活动
  • 应用
  • 吐槽
  • 登录/注册

AcWing 1015. 摘花生    原题链接    简单

作者: 作者的头像   rushhhhh ,  2021-02-19 20:04:20 ,  阅读 11


0


#include <iostream>
#include <cstring>
using namespace std;


const int N = 110;
int n;
int r, c;
int t;
int f[N];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n ;
    while(n--)
    {
        cin >> r >> c;
        memset(f, 0, sizeof(f));
        for(int i=1; i<=r; i++)
        {
            for(int j=1; j<=c; j++)
            {
                cin >> t;
                f[j] = max(f[j-1], f[j]) + t;
            }
        }
        cout << f[c] << endl;
    }

    return 0;
}

0 评论

你确定删除吗?

© 2018-2021 AcWing 版权所有  |  京ICP备17053197号-1
联系我们  |  常见问题
AcWing
请输入登录信息
更多登录方式: 微信图标 qq图标
请输入绑定的邮箱地址
请输入注册信息