动态规划
文章平均质量分 58
征服所有不服
行走在西子湖畔,我是江南最尊贵的神犇。流浪在CSDN,我是世间最美的情郎。
展开
-
【剑指紫金港】1045 Favorite Color Stripe 贪心
A 1045 Favorite Color Stripe题目链接Problem DescriptionEva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces and sewing the remaining parts t原创 2021-02-28 12:21:38 · 77 阅读 · 0 评论 -
【剑指紫金港】1040 Longest Symmetric String DP回文字符串
A 1040 Longest Symmetric String DP回文字符串题目链接Problem DescriptionGiven a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, h原创 2021-02-01 11:02:58 · 108 阅读 · 0 评论 -
钱哥养猪 动态规划
题目标题Problem Description为情所困退学在家的钱哥毅然决定养猪!在2010年1月1日,他买了一只刚出生的母猪幼仔,假设每只小母猪从第3个年头开始,每年的第一天都会生出4只小母猪,同时,钱哥会在每年的12月31日售出所有差一天就要年满5周岁的猪。请计算:在第N年(2010年是第1年,2011是第2年,依次类推)的今天(5月4日),钱哥的养猪场会存栏多少只猪?Input输入数据第一行是一个整数T(0<T<=40),表示测试数据的组数.接下来有T行,每行有一个数N(0&原创 2021-01-07 19:46:55 · 580 阅读 · 0 评论 -
【剑指紫金港】1007 Maximum Subsequence Sum 动态规划&滑动窗口
题目标题题目链接Problem DescriptionInputOutputSample Input:ASample Output:2题目大意:牛解题思路:龙AC代码#include <bits/stdc++.h>using namespace std;#define max(a, b) ((a) > (b) ? (a) : (b))const int maxn = 10005;int dp[maxn],num[maxn];int main(int原创 2020-12-18 22:12:33 · 124 阅读 · 1 评论 -
Max Sum(HDU 1003)动态规划&最大连续和
HDU1003 Max Sum题目链接Problem DescriptionGiven a sequence a[1],a[2],a[3]…a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe first line of the inpu原创 2020-12-01 23:45:13 · 99 阅读 · 0 评论