[USACO08JAN]Running】的更多相关文章

嘟嘟嘟 这很显然是一道dp题. 令dp[i][j]表示第 i 分钟末,疲劳度为 j 是的最大跑步距离,则 dp[i][0] = max(dp[i - 1][0], max(dp[i - j][j])) dp[i][j] = max(dp[i - 1][j - 1] + a[i]) 因为题中说即使疲劳值为0了,仍可以休息,所以dp[i][0]也可以从dp[i - 1][0]转换过来. #include<cstdio> #include<iostream> #include<cm…
P1353 [USACO08JAN]跑步Running 显然的dp 设$f[i][j]$表示进行到第$i$分钟时,$j$疲劳度下的最远距离,$d[i]$为第$i$分钟下能跑的距离 分类讨论 1.运动:显然$f[i][j]=max(f[i][j],f[i-1][j-1]+d[i])$ 2.休息:我们枚举第$u(u<i)$分钟,休息到第$i$分钟时刚好疲劳度下降到$0$ 显然$f[i][0]=max(f[i][0],f[i-u][u])$ 注意疲劳度为$0$时仍可以继续休息,那么$f[i][0]=m…
题目描述 The cows are trying to become better athletes, so Bessie is running on a track for exactly N (1 ≤ N ≤ 10,000) minutes. During each minute, she can choose to either run or rest for the whole minute. The ultimate distance Bessie runs, though, depe…
题目描述 The cows are trying to become better athletes, so Bessie is running on a track for exactly N (1 ≤ N ≤ 10,000) minutes. During each minute, she can choose to either run or rest for the whole minute. The ultimate distance Bessie runs, though, depe…
题目描述 The cows are trying to become better athletes, so Bessie is running on a track for exactly N (1 ≤ N ≤ 10,000) minutes. During each minute, she can choose to either run or rest for the whole minute. The ultimate distance Bessie runs, though, depe…
题目描述 The cows are trying to become better athletes, so Bessie is running on a track for exactly N (1 ≤ N ≤ 10,000) minutes. During each minute, she can choose to either run or rest for the whole minute. The ultimate distance Bessie runs, though, depe…
USACO!!! 唉!无一例外又是母牛(终于知道美国的牧场养什么了) 今天的主人公是一个叫贝茜的公主病母牛(好洋气) 可是她叫什么和我们理解题好像没有什么关系 通过读题我们可以发现她有三个傲娇的地方 1.她要继续走 2.她要中途休息,但是要休息到完全恢复体力,即疲劳度为0 3.她要发奋图强一直走下去,直到体力耗尽 那么我们针对这三种情况就可以发现有三个状态转移方程式 1.她要继续走那么疲劳度+1,再加上这一秒所走的距离 f[i-1][j-1]+a[i] 2.她要中途休息,那么疲劳度休息到0,距离…
我死了...被绿题虐...看来我的水平有待提高...QWQ 好吧,就是跑步的时候只能从跑步的状态转移过来 休息的时候可以从上一次休息时转移过来,也可以从某次跑步的时转移过来,需要枚举从哪一个状态转移来的 就是这样,可是我不会. #include<cstdio> #include<iostream> #include<cstring> #define R register int ,M=; using namespace std; inline int g() { R r…
动态规划 状态 dp[i][j]表示第i分钟疲劳值为j的最大值 初始 全部都为一个最小值"0" 转移 考虑休息和走 如果当前疲劳值比时间要大,显然不可能出现这种情况 如果比时间小 dp[i][0]=max(dp[i][0],dp[i-j][j]); 还有走的情况 dp[i][0]=max(dp[i-1][j-1]+d[i],dp[i][j]); 答案 根据设计的状态不难得出最终的答案为dp[n][0] 完整代码: #include<bits/stdc++.h> using…
作者Alistair Cockburn, Crystal Clear的7个成功要素,写得挺好. 敏捷方法的关注点,大家可以参考,太激动所以转载了. 原文:http://www.informit.com/articles/article.aspx?p=345009 Property 1. Frequent Delivery The single most important property of any project, large or small, agile or not, is that…