摘要:
题意:N个城市,经过每条边有两种代价,一种是经过了这条边给定的城市,代价为Pi,另一种是直接到对面城市,代价为Ri,求小朋友从1~N的最小代价(注:边是有向的) 题解: spfa dis[i][j]表示到i号城市经过了j状态城市的最小代价,直接搞搞傻逼转移就好了 阅读全文
posted @ 2017-09-12 20:19
HLX_Y
阅读(150)
评论(0)
推荐(0)
摘要:
题意:N头牛,每头牛有一个重量和一个力量,每头牛承受的YaLi为在它上面的所有牛的重量之和减去它的力量,要求最小化最大YaLi 题解: 贪心 重量+力量越大的放在越下面 证明: 假设最优放置,取相邻两头牛A(w1,s1),B(w2,s2),sum表示第一头牛所承受的重量 A的代价:a=sum-s1, 阅读全文
posted @ 2017-09-12 17:28
HLX_Y
阅读(168)
评论(0)
推荐(0)
摘要:
题意:有n头牛,每头牛两个元素(s,t),选择若干头牛使∑s+∑t最大,且∑s、∑t非负 题解: dp(带决策条件的状态) 状态:dp[j]表示s和为j时,t和的最大值 转移:dp[j+s[i]]=max{dp[j]+t[i]} (j>=0) 这样是不行的,因为s[i]会被重复转移,所以要把当前被转 阅读全文
posted @ 2017-09-12 15:47
HLX_Y
阅读(193)
评论(0)
推荐(0)
摘要:
Description Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first visit, the tools are 阅读全文
posted @ 2017-09-12 12:06
HLX_Y
阅读(148)
评论(0)
推荐(0)
摘要:
Description As a reward for record milk production, Farmer John has decided to start paying Bessie the cow a small weekly allowance. FJ has a set of c 阅读全文
posted @ 2017-09-12 12:00
HLX_Y
阅读(208)
评论(0)
推荐(0)
摘要:
Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows do not mind climbing up 阅读全文
posted @ 2017-09-12 09:08
HLX_Y
阅读(183)
评论(0)
推荐(0)

浙公网安备 33010602011771号