作业帮 > 英语 > 作业

ACM数学搭配问题AssignmentsIn a factory, there are N workers to fin

来源:学生作业帮 编辑:拍题作业网作业帮 分类:英语作业 时间:2024/05/01 00:52:24
ACM数学搭配问题
Assignments
In a factory, there are N workers to finish two types of tasks (A and B). Each type has N tasks. Each task of type A needs xi time to finish, and each task of type B needs yj time to finish, now, you, as the boss of the factory, need to make an assignment, which makes sure that every worker could get two tasks, one in type A and one in type B, and, what's more, every worker should have task to work with and every task has to be assigned. However, you need to pay extra money to workers who work over the standard working hours, according to the company's rule. The calculation method is described as follow: if someone’ working hour t is more than the standard working hour T, you should pay t-T to him. As a thrifty boss, you want know the minimum total of overtime pay.
Input
There are multiple test cases, in each test case there are 3 lines. First line there are two positive Integers, N (N
第35届亚洲区哈尔滨站最水的一道题 - -*
一种类型的工作时间升序排列,另一种降序排列
对应相加,大于标准工作时间的,另存SUM++;
#include"iostream"
#include"algorithm"
#include"cstdio"
using namespace std;
int cmp(const int &a,const int &b)
{
if(a>b)
return 1;
return 0;
}
int main()
{
int a[1001],b[1001],i,n,t,s;
while(scanf("%d%d",&n,&t)==2)
{
s=0;
for(i=0;i