![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心算法
狠人王
怀着一颗热情的心,追随自己的梦想!
展开
-
POJ 1922 Ride to school
Many graduate students of Peking University are living in Wanliu Campus, which is 4.5 kilometers from the main campus - Yanyuan. Students in Wanliu have to either take a bus or ride a bike to go to sc...原创 2019-03-17 11:22:16 · 188 阅读 · 0 评论 -
CodeForce 231C To Add or Not to Add(前缀和贪心)
A piece of paper contains an array of n integers a1, a2, …, an. Your task is to find a number that occurs the maximum number of times in this array.However, before looking for such number, you are al...原创 2019-07-30 15:53:32 · 148 阅读 · 0 评论 -
135. candy(贪心法)
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 requirements:Each child must have at least one cand...原创 2019-08-03 17:26:41 · 103 阅读 · 0 评论 -
CodeForces - 218B (贪心)
这道题可以用优先队列做,也可以用贪心做,我一开始是用贪心做的,优先队列我掌握的不熟练,核心用法我也没有掌握清楚。这道题,调试的时候出现了我以前经常会出的bug(因为已经出现了好几次这样的错误,真的要好好总结一下),导致我用了太多时间在调试上,这道题的样式是求极端情况,所以我一开始就用贪心,这篇博客总结两种不同的方法。题面:Lolek and Bolek are about to travel ...原创 2019-07-23 11:37:04 · 235 阅读 · 0 评论 -
【codeforce】B. Equal Rectangles(贪心)
You are given4n4nsticks, the length of theii-th stick isaiai.You have to creatennrectangles, each rectangle will consist of exactly44sticks from the given set. The rectangle consists of four...原创 2019-08-14 08:58:56 · 410 阅读 · 0 评论 -
【codeforce】B. Block Adventure(贪心)
Gildong is playing a video game called Block Adventure. In Block Adventure, there are n columns of blocks in a row, and the columns are numbered from 1 to n. All blocks have equal heights. The height ...原创 2019-08-12 11:20:28 · 281 阅读 · 0 评论 -
【CodeForces】 - 279E(贪心|DP)
Valera considers a numberbeautiful, if it equals2kor -2kfor some integerk(k ≥ 0). Recently, the math teacher asked Valera to represent numbernas the sum of beautiful numbers. As Valera is real...原创 2019-09-05 21:57:19 · 261 阅读 · 0 评论 -
【codeforce】A. There Are Two Types Of Burgers(贪心)
https://codeforces.com/contest/1207/problem/A#include<bits/stdc++.h>#define ll long longusing namespace std;ll n,x,ans;int main(void){ int T,b,p,f,h,c; cin>>T; int cnt1=...原创 2019-09-09 20:04:21 · 144 阅读 · 0 评论