简单任务调度问题(贪心)

本文探讨使用贪心算法解决简单任务调度问题。任务开始时间b[i]和结束时间e[i]已知,目标是在同一时间内参与最多的任务。贪心策略是始终选择最早结束的任务,以使时间更紧凑,确保任务数量最大化。
摘要由CSDN通过智能技术生成

simple task scheduling problem

Today we will talk about task scheduling problem using greedy thinking. In fact, greedy algorithm is quite uncommon, for most problems in our life can not be solved just by greedy algorithm. But here is one, a simple task scheduling problem. Let’s solve it!
Description:.
Suppose you have a list of work to do. For each task, it starts from b[i] and ends at e[i]. Now give you the number of the whole tasks. You’ve already know that you can not do multiple tasks at the same time, but you want to participate in the most tasks in this period of time to get more money(hhh). So, how many tasks can you participate in at most?
sample
input

5
1 3
2 5
4 7
6 9
8 10

output
3

How to think this problem?

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值