解题关键:先由贪心的思想得出任何一个位置只能取1或者a[i],然后dp即可. #include<bits/stdc++.h> using namespace std; typedef long long ll; #define maxn 50002 ]; int main(){ int n; cin>>n; ;i<n;i++) cin>>a[i]; dp[][]=dp[][]=; ;i<n;i++){ dp[i][]=max(dp[i-][],dp[i-][…
传送门: http://poj.org/problem?id=3666 Making the Grade Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9468 Accepted: 4406 Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would lik…
Kattis - bank [简单DP] Description Oliver is a manager of a bank near KTH and wants to close soon. There are many people standing in the queue wanting to put cash into their accounts after they heard that the bank increased the interest rates by 42% (f…