2905. Finance

单点时限: 5.0 sec

内存限制: 256 MB

The Big Boss Company (BBC) principal is going to prepare a vacation schedule for the next year. Each employee of BBC gets a four-week vacation each year. A vacation can be divided into several parts. Each part consists of several weeks. The parts are separated by at least one work week.

According to the law, the pay for each vacation part is calculated separately from the others as follows. Consider the employee’s salary for the period of 52 weeks preceding the current part of the vacation and divide it by 52. (A year is assumed to consist of exactly 52 weeks.) All vacation pays during these 52 weeks are ignored for the purpose of salary calculation. The result is multiplied by the number of weeks in this part of the vacation (ranging from 1 to 4).

Given the vacation schedules for the current year, you should help the BBC principal to construct the next year’s schedule that minimizes the total vacation pay costs. Since the pays for distinct employees are unrelated you are to solve the problem assuming that there is only one employee.


The input contains four integers listed in the ascending order giving the vacation weeks in the current year’s schedule. Weeks are specified by numbers ranging from $1$ to $52$.


Output the numbers of vacation weeks for the next year in the ascending order. The vacation schedule should minimize the vacation pay costs. If there are several equivalent solutions, output any of them.


2 3 20 21
1 2 3 5


The calculation of the pay for the first part considers 52 − 4 = 48 work weeks while the calculation of the second part considers 52 − 5 = 47 work weeks.

20 人解决,24 人已尝试。

22 份提交通过,共有 57 份提交。

4.4 EMB 奖励。

创建: 11 年,2 月前.

修改: 4 年,7 月前.

最后提交: 1 年,8 月前.

来源: N/A