Leetcode 3181. Maximum Total Reward Using Operations II 1. 解题思路2. 代码实现 题目链接:3181. Maximum Total Reward Using Operations II 1. 解题思路 这一题的话思路上依然还是动态规划的思路,核心的迭代关系式如下: def dp(idx, pre_sum) :if nums[idx
#include<cstdio>#include<cstring>#define MAX(x,y) ((x)>(y)?(x):(y))#define MIN(x,y) ((x)>(y)?(y):(x))long long dp1[1010];long long dp2[1010];long long MID;int main(){int n,k;long long ans;scan