![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
贪心
Cu1ii*
平凡的铁匠
展开
-
Buy and Resell HDU - 6438(补)更新贪心
The Power Cube is used as a stash of Exotic Power. There are nn cities numbered 1,2,…,n1,2,…,n where allowed to trade it. The trading price of the Power Cube in the ii-th city is aiai dollars per cube. Noswal is a foxy businessman and wants to quietly make原创 2020-09-19 20:03:19 · 129 阅读 · 0 评论 -
日常训练 1(H)
Poj 2456 题意: 往n个牛舍放m个牛,尽可能的让两头牛之间距离远,问安排好后最近的两头牛的距离。 思路: 可以采用遍历的方法,期间为减少运算量可以使用二分法来减少遍历次数 (因为数据量太大,应使用scanf和printf进行输入输出)。 #include <iostream> #include <algorithm> using namespace std; i...原创 2020-02-27 17:35:18 · 177 阅读 · 0 评论 -
过桥问题 (贪心)
题目链接 一个典型的过桥问题 代码 #include <iostream> #include <cstdio> #include <algorithm> #include <vector> #include <queue> using namespace std; int main() { int n,stu[105]; ...原创 2020-04-19 18:13:49 · 1223 阅读 · 0 评论 -
会场安排问题 优先队列
Description 假设要在足够多的会场里安排一批活动,并希望使用尽可能少的会场。设计一个有效的贪心算法进行安排。(这个问题实际上是著名的图着色问题。若将每一个活动作为图的一个顶点,不相容活动间用边相连。使相邻顶点着有不同颜色的最小着色数,相应于要找的最小会场数。) 对于给定的k个待安排的活动,计算使用最少会场的时间表。 Input 输入数据的第一行有1 个正整数k(k≤10000),表示有k...转载 2020-04-03 13:19:28 · 384 阅读 · 0 评论