工厂机器安排(贪心)

工厂机器安排(贪心)

Today the company has m tasks to complete. The ith task need xi minutes to complete. Meanwhile, this task has a difficulty level yi. The machine whose level below this task’s level yi cannot complete this task. If the company completes this task, they will get (500xi+2yi) dollars.

The company has n machines. Each machine has a maximum working time and a level. If the time for the task is more than the maximum working time of the machine, the machine can not complete this task. Each machine can only complete a task one day. Each task can only be completed by one machine.

The company hopes to maximize the number of the tasks which they can complete today. If there are multiple solutions, they hopes to make the money maximum.

函数 Maths Functions

本篇将会介绍 cmath 库以及它在C++中提供的功能,如平方根、乘方和三角函数。 C++ 数学库 平方根 乘方 三角函数 C++数学库 C++数学库实际上是C语言的数学库,它易于使用,并通过包括cmath来访问。 #include <cmath> 现在我们有了cmath,可以使用一些简洁的函数。 平方根 函数 sqrt 可以用来计算一个数的平方根。它只需要一个参数numbe […]

批处理作业调度问题

批处理作业调度是要从 n 个作业的所有排列中找出有最小完成时间和的作业调度,所以批处理调度问题的解空间是一棵排列树。按照回溯法搜索排列树的算法框架,设开始时x = [1, .., n]是所给的 n 个作业,则相应的排列树由所有排列构成。

装载问题-回溯法

有n个集装箱要装上2艘载重量分别为C1和C1的轮船。其中集装箱i的重量为Wi,且(W1+W2+….+Wn<=C1+C2)。 装载问题是,是否有一个合理装载方案,可将这n个集装箱都装上这2个轮船,若有,请给出解决方案。