[Huawei OD] Paper C real question 100% passed: Earn points by performing tasks C/C++ implementation source code

 Other implemented portals:

[Huawei OD] Paper C real question 100% passed: Earn points by performing tasks Java source code implementation - CSDN Blog

 [Huawei OD] Paper C real question 100% passed: perform tasks to earn points python source code implementation - CSDN Blog

Topic description:

There are N tasks that need to be processed. Only one task can be processed at the same time. The time required to process each task is fixed at 1.
Each task has a latest processing time limit and a points value. Only when the task is completed before the latest processing time can the corresponding point reward be obtained.
The time available for processing tasks is limited. Please tell me the maximum points that can be obtained within the limited time.

Enter description

The first line is a number N, indicating that there are N tasks, 1<=N<=100
The second line is a number T, indicating the time available to process the task. 1<=T<=100
Next N lines, each line contains two space-separated integers (SLA and V). SLA represents the latest processing time of the task, and V represents the points corresponding to the task. . 1<=SLA<=100, 0<=V<=100000

Output description

Maximum points available

Example 1

The input and output examples are only for debugging, and the background judgment data is generally not

おすすめ

転載: blog.csdn.net/mars1199/article/details/135020710