A1375 | [COCI-2017_2018-contest7]#6 Timovi
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
We need to arrange M kids in N teams. We begin by placing K kids in each team, starting from the first to the N^th team. When we finish with the N^th team, we switch directions and continue, placing K kids in each team, from the (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 N^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.
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 N^th team.
输入输出样例
输入 #1
2 1 3
输出 #1
2 1
输入 #2
3 2 7
输出 #2
2 3 2
输入 #3
4 5 6
输出 #3
5 1 0 0
In test cases worth a total of 40 points, it will hold M / K ≤ 200 000.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted