#K39457. Even Distribution of On-Call Days
Even Distribution of On-Call Days
Even Distribution of On-Call Days
You are given a list of employee names and an integer n representing the total number of days in a scheduling period. Your task is to distribute the days as evenly as possible among the employees in a round-robin fashion. Formally, if there are k employees, day i (1-indexed) should be assigned to the employee at position \( (i-1) \mod k \).
For example:
- If the input employees are "Alice Bob" and n = 4, then the distribution is: Alice gets days 1 and 3, Bob gets days 2 and 4.
- If the input employees are "Alice Bob Charlie" and n = 10, then the distribution is: Alice gets days 1, 4, 7, 10; Bob gets days 2, 5, 8; and Charlie gets days 3, 6, 9.
inputFormat
The input is read from standard input and consists of two lines:
- The first line contains the names of the employees separated by spaces.
- The second line contains a single integer n, which is the total number of days in the scheduling period.
outputFormat
For each employee (in the order given in the input), print a line in the following format:
EmployeeName: d1 d2 ...
where d1, d2, ...
are the days assigned to that employee. If an employee has no day assigned, print just the employee name followed by a colon.
Alice Bob
4
Alice: 1 3
Bob: 2 4
</p>