ACM: uva 1467 - Installations
来源:互联网 发布:ios 网络请求第三方 编辑:程序博客网 时间:2024/05/16 00:28
Installations
In the morning, service engineers in a telecomcompany receive a list of jobs which they must serve today. Theyinstall telephones, internet, ipTVs, etc and repair troubles withestablished facilities. A client requires a deadline when therequested job must be completed. But the engineers may not completesome jobs within their deadlines because of job overload. For eachjob, we consider, as a penalty of the engineer, the differencebetween the deadline and the completion time. It measures how longthe job proceeds after its deadline. The problem is to find aschedule minimizing the sum of the penalties of the jobs with thetwo largest penalties.
A service engineer gets a list ofjobs
For example, there are sixjobs
Figure 1. The optimal schedule of the example
Input
Your program is to read from standard input. Theinput consists of
Output
Your program is to write to standard output. Printexactly one line for each test case. The line contains the sum ofthe penalties of the jobs with the two largest penalties.
The following shows sample input and ouput forthree test cases.
SampleInput
3
6
1 7
4 7
2 4
2 15
3 5
3 8
7
2 17
2 11
3 4
3 20
1 20
4 7
5 14
10
2 5
2 9
5 10
3 11
3 4
4 21
1 7
2 9
2 11
2 23
SampleOutput
7
0
14
题意: 有n个的任务要完成, 给出你它完成需要的时间和deadline, 惩罚值 = max(完成的时刻-deadline,0);
解题思路:
代码:
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
#define MAX 505
struct node
{
}a[MAX];
int n;
inline int max(int a, int b)
{
}
inline int min(int a, int b)
{
}
int solve()
{
}
int main()
{
//
}
- ACM: uva 1467 - Installations
- ACM: uva 1335 - Beijing Guards
- ACM: uva 10391 - Compound Words
- ACM: uva 10534 - Wavio Sequence
- ACM: uva 11538 - Chess Queen
- ACM: uva 1073 - Glenbow Museum
- ACM: 数学题 uva 11300
- ACM: uva 11584 -
- ACM: uva 11464
- ACM: uva 3902
- ACM: uva 10382
- ACM: uva 11134
- ACM: uva 11174 - Stand in a Line
- ACM: uva 1276 - Network
- ACM: uva 1450 - Airport
- ACM: uva 10125 - Sumsets
- ACM: uva 1451 - Average
- ACM: uva 1468 - Restaurant
- Python - 网络基础
- Python - pyqt 和 opencv
- ACM: uva 1276 - Network
- ACM: uva 1335 - Beijing Guards
- ACM: uva 1450 - Airport
- ACM: uva 1467 - Installations
- ACM: LA 3266 -&nb…
- ACM: uva 11389 -&…
- ACM: uva 1325 -&n…
- ACM: uva 10827 -&…
- [蓝桥杯]常用算法-递归法
- ACM: uva 10125 - Sumsets
- Java发展历史
- boost的shared_ptr循环引用(1)