1.22题目翻译

题目链接Machine Schedule | JXNUOJ

题目:

As we all know, machine scheduling is a very classical problem in computer science and has been studied for a very long history. Scheduling problems differ widely in the nature of the constraints that must be satisfied and the type of schedule desired. Here we consider a 2-machine scheduling problem.

There are two machines A and B. Machine A has n kinds of working modes, which is called mode_0, mode_1, …, mode_n-1, likewise machine B has m kinds of working modes, mode_0, mode_1, … , mode_m-1. At the beginning they are both work at mode_0.

For k jobs given, each of them can be processed in either one of the two machines in particular mode. For example, job 0 can either be processed in machine A at mode_3 or in machine B at mode_4, job 1 can either be processed in machine A at mode_2 or in machine B at mode_4, and so on. Thus, for job i, the constraint can be represent as a triple (i, x, y), which means it can be processed either in machine A at mode_x, or in machine B at mode_y.

Obviously, to accomplish all the jobs, we need to change the machine's working mode from time to time, but unfortunately, the machine's working mode can only be changed by restarting it manually. By changing the sequence of the jobs and assigning each job to a suitable machine, please write a program to minimize the times of restarting machines. 

The input file for this program consists of several configurations. The first line of one configuration contains three positive integers: n, m (n, m < 100) and k (k < 1000). The following k lines give the constrains of the k jobs, each line is a triple: i, x, y.
The input will be terminated by a line containing a single zero.

The output should be one integer per line, which means the minimal times of restarting machine.

正如我们所知,机器调度问题是计算机科学中非常经典的问题也是被长时间学习的问题。调度问题在这些约束条件的性质上有很大的不同 必须满足和所需的时间表类型。这里我们考虑一个两台机器的调度问题。

机器A和B有两种。机器A有n种工作模式,被称为mode_0,mode_1,...,mode_n-1,同样机器B有m种工作模式,mode_0,mode_1,…,mode_m-1。在t时 他开始说,他们都在mode_0工作。对于给定的k,每个都可以以特定模式对两台机器中的任何一个进行处理。例如,作业0既可以在mode_3的机器A中处理,也可以在mode_4的机器B、作业1中处理 可以在mode_2机器A中或在mode_4机器B中处理,以此类推。因此,对于作业i,约束可以表示为三重(i,x,y),这意味着它可以在中进行处理 A在mode_x,或者B在mode_y。显然,为了完成所有的工作,我们需要不时地改变机器的工作模式,但不幸的是,机器的工作模式只能通过手动重新启动来改变。由c 挂起作业的顺序,并将每个作业分配给合适的机器,请编写一个程序,以尽量减少重新启动机器的时间。这个程序的输入文件由多个配置组成。一个构型的第一行包含三个正整数:n、m(n、m<100)和k(k<1000)。下面的k行giv ek个作业的约束条件,每一行都是一个三重的:i,x,y。输入将由一个包含一个零的行终止。

输出应该是每行一个整数,这意味着重新启动机器的最小时间。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值