—贪心
MissZhou要努力
不晓日月,不辩兰艾,终日碌碌,安与燕雀相随乎
展开
-
nefu oj 986 林大的入学体检(运算符重载在排序中的运用)
sum=(sum+m.a+sum*m.b)%mod;对应描述当李华刚来到校医院时每个项目要排的时间为ai秒,如果他选择了其中一个项目先排队,那么对于其他的项目每秒增加额外排队时间为bi注意理解 还有 数组开小了就会RE =.= P.S.本来是单组输入的题多组输入也能过~ bool cmp(time x,time y) { return x.a*y.b }原创 2015-08-01 22:23:04 · 642 阅读 · 0 评论 -
leetcode 55. Jump Game【贪心】
https://leetcode.com/problems/jump-game/description/ Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your ...原创 2018-10-25 10:00:05 · 130 阅读 · 0 评论 -
leetcode 714. Best Time to Buy and Sell Stock with Transaction Fee【贪心??水题】
Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete as many tr...原创 2018-06-13 10:08:10 · 304 阅读 · 0 评论 -
leecode 135. Candy【贪心】
https://leetcode.com/problems/candy/description/There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi...原创 2018-04-08 11:55:31 · 164 阅读 · 0 评论 -
[leetcode]376. Wiggle Subsequence 贪心
遇到间距=0的直接减去,连续是正数、负数的情况少减去一个 我怎么12行的代码还要搜题解 mdzz class Solution { public: int wiggleMaxLength(vector& nums) { int leftnum=nums.size(); if(leftnum==0||leftnum==1)return leftnu原创 2017-09-20 09:24:51 · 421 阅读 · 0 评论 -
leetcode402. Remove K Digits【单调栈变形】
Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The length of num is less than 10002 and will be原创 2017-05-29 08:54:03 · 1967 阅读 · 0 评论 -
leetcode gas-station【最大序列变形】
There are N gas stations along a circular route, where the amount of gas at station i isgas[i]. You have a car with an unlimited gas tank and it costscost[i]of gas to travel from station i to its原创 2017-04-12 11:40:24 · 399 阅读 · 0 评论 -
leetcode 55. Jump Game [贪心]
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if原创 2017-04-12 13:37:47 · 402 阅读 · 0 评论 -
LeetCode 45 Jump Game II【贪心】
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Your goal is to原创 2017-04-17 20:11:14 · 372 阅读 · 0 评论 -
bestcoder两周年前三题hdu5718,5719,5720
一周多上山实习只学了一些python,做题的手感差了好多QAQ,昨天晚上最开始电脑还更新重启折腾了好久,换成台式机做的,只做了一个题居然rating还涨了168,始料未及 前三个都是乱搞(第三个有一点贪心的意思 hdu5718Oracle Accepts: 599 Submissions: 2576 Time Limit: 8000/4000 MS (Java/Oth原创 2016-07-18 17:25:14 · 1327 阅读 · 0 评论 -
FZU 2141 Sub-Bipartite Graph【贪心】
Description Given a simple undirected graph G with n vertices and m edges, your task is to select a sub-bipartite graph of G with at least m/2 edges. In the mathematical field of graph theory, a b原创 2016-07-03 15:18:40 · 491 阅读 · 0 评论 -
hdu4882ZCC Loves Codefires【贪心】2014多校联合
ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1398 Accepted Submission(s): 650 Problem Description Though ZCC原创 2016-06-25 21:46:55 · 425 阅读 · 0 评论 -
CodeForces 3B Lorry 贪心
题目大意是有体积为v的背包,有体积为1和2的两种物品若干,这些物品都有各自的价值。求如何取这些物品可使背包中物品的价值最大。 开始一看到是背包就傻眼了==因为数据量太大1 ≤ n ≤ 105; 1 ≤ v ≤ 109 搜题解有说用优先队列做的,好麻烦==有一种思路我很喜欢:既然涉及到背包或者贪心这类DP问题,一定是取最优的解。即如果把两种船只分别存到两个数组里,再由大到小排序,最终的结果一定原创 2015-07-10 09:24:27 · 1171 阅读 · 0 评论 -
poj1862Stripies【哈夫曼合并木棍】
Description Our chemical biologists have invented a new very useful form of life called stripies (in fact, they were first called in Russian - polosatiki, but the scientists had to invent an English原创 2016-02-04 11:30:14 · 424 阅读 · 0 评论 -
2015多校联合第六场 hdu5360hiking
Problem Description There are n soda conveniently labeled by 1,2,…,n. beta, their best friends, wants to invite some soda to go hiking. The i-th soda will go hiking if the total number of sod原创 2015-09-03 16:00:40 · 533 阅读 · 0 评论 -
nefu989考试安排
description 开学一个月之后,又到了考试月,不过现在老师比较开明,除了老师自己安排的时间表ai外,小明也给他自己安排了一个时间表;小明可以在任意一科的考试可以从他自己安排的时间选,也可以就按照老师的安排来,但是要保证考试安排日程是非递减序列,求满足这个条件的最后一天考试时间。不能改变老师安排的考试的先后次序 input 给定一个n代表考试的科目总数,剩下n行 ,每行两个数ai,原创 2015-08-01 22:44:06 · 567 阅读 · 0 评论 -
leetcode56. Merge Intervals【贪心】
Given a collection of intervals, merge all overlapping intervals. Example 1: Input: [[1,3],[2,6],[8,10],[15,18]] Output: [[1,6],[8,10],[15,18]] Explanation: Since intervals [1,3] and [2,6] overlaps...原创 2018-10-25 11:01:24 · 179 阅读 · 0 评论