D
D
Dima2016-06-22 10:20:58
Programming
Dima, 2016-06-22 10:20:58

What do you need to know and understand in order to solve the problem of making a simple schedule?

Hello, dear Toaster users. I need to solve such a problem, but since I have no experience in solving such problems, and the problem is not so obvious (based on the example indicated in the condition). Tell me what you need to read / study / parse, or what type such problems generally belong to in order to find material on them and solve it. Attempts to solve "in a simple way" and searches on the net did not improve the situation, except that they pointed to mathematical / linear programming and scheduling theory. But in those books that I found, the tasks are similar, but at the same time they are far from this, in my opinion.

В музее N залов. Посещение каждого зала экскурсией школьников занимает 1 час, при этом одновременно в зале может находится только одна группа. В один день на экскурсии записалось M групп школьников, и они хотят обойти все залы. Очевидно, что для посещения музея всеми группами потребуется K = max(M, N) часов, и экскурсоводы должны точно знать, в какой зал в какое время какую группу вести. Создайте расписание посещений залов группами школьников такое, чтобы за K часов все группы посетили все залы.

К сожалению, описание входных и выходных данных не помещается (Тостер обрезает описание). Оригинал задачи размещен здесь (PDF) (стр. 4, зад. 3)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MiiNiPaa, 2016-06-22
@CrazyFail

It's elementary. Shifts.
If M > N, we push into the halls of the group 1 - N in order. Then groups 2 - N+1, and so on. Group M is followed by group 1. Repeat M times.
In the case of M < N, the solution is the same, but you have to make N passes and complete the missing halls with zeros.
Example for N = 3 M = 5:

1 2 3
2 3 4
3 4 5
4 5 1
5 1 2

Example for N = 5 M = 2:
1 2 0 0 0
2 0 0 0 1
0 0 0 1 2
0 0 1 2 0
0 1 2 0 0

C++ program example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question