#P5051. [COCI2017-2018#7] Timovi

[COCI2017-2018#7] Timovi

题目描述

We need to arrange M kids in N teams. We begin by placing K kids in each team, starting from the first to the NthN^{th} team. When we finish with the NthN^{th} team, we switch directions and continue, placing K kids in each team, from the (N1)th(N-1)^{th} to the first team, respectively. When we finish with the first team, we switch directions again and continue the process from the second to the NthN^{th} team, respectively, and so on until there are no kids left to distribute. For example, if we have three teams, we will place K kids in teams in the following order: first team, second team, third team, second team, first team, second team, etc.

If, at any points, there are less than K kids left to place in the current team, we place all the remaining kids in that team and end the process.

Output the number of kids in each team when the process ends.

输入格式

The first line of input contains the integers N (2 ≤ N ≤ 200 000), K and M (1 ≤ K ≤ M ≤ 2 000 000 000) from the task.

输出格式

In a single line, output the number of kids in each of the N teams, respectively from the first to the NthN^{th} team.

题目大意

mm个人放在nn个队伍里。 规则:

  • 每次放kk个人
  • 顺序为1th1^{th}->2th2^{th}->3th3^{th}->……->(n1)th(n-1)^{th}->nthn^{th}->(n1)th(n-1)^{th}->(n2)th(n-2)^{th}->……->2th2^{th}->1th1^{th}->2th2^{th}->……
  • 一直重复到当前剩余人数<k\text{当前剩余人数}<k为止。此时剩下的人全部放在当前队里

输入格式: 一行,分别是n、k、m\text{n、k、m}

输出格式: 一行,nn个数,分别是每个队伍分到的人数

2 1 3
2 1
3 2 7
2 3 2
4 5 6
5 1 0 0

提示

In test cases worth a total of 40 points, it will hold M / K ≤ 200 000.