Nadan
InterviewTime limit1sMemory limit64 MB
Split K into N distinct positive integers that sum to K, and print one such distribution.
- Level
Easy3 of 10
- Topics
- Greedy, Math, Implementation, Combinatorics
- Solved
- No attempts yet
Problem
Along with being a palindrome, Nadan is a successful businessman who finances young software developers when they start working on their projects. This year he decided to distribute K kunas (Croatian currency) among N projects so that each project gets at least one kuna and all projects get different amounts of kunas. This is always possible.
Write a program that, for given N and K, finds one way to distribute K kunas among N projects.
Input
The first line contains a positive integer K (100 ≤ K ≤ 1 000 000), the number from the task description. The second line contains a positive integer N (1 ≤ N ≤ 100), the number from the task description.
Output
For the chosen distribution, output the amount the first project receives on the first line, the amount the second project receives on the second line, and so on up to the N-th line, where you output the amount the N-th project receives.