Submit | All submissions | Best solutions | Back to list |
ROB - Robbery |
k bandits robbed a bank. They took away n gold coins. Being a progressive group of robbers they decided to use the following procedure to divide the coins. First the most respected bandit takes 1 coin, then the second respected takes 2 coins, ..., the least respected takes k coins, then again the most respected takes k+1 coins, ans so on, until one of the bandits takes the remaining coins. Calculate how much gold each of the bandits gets.
Input
The first line of the input contains number t – the amount of tests. Then t test descriptions follow. Each test consists of two integers n and k - the amount of coins and bandits respectively.
Constraints
1 <= t <= 500
1 <= n <= 109
2 <= k <= 100
Output
For each test print the amounts of coins each bandit gets separated by spaces.
Example
Input: 3 10 2 11 3 12 4 Output: 4 6 5 3 3 3 2 3 4
Added by: | Spooky |
Date: | 2009-11-03 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 NODEJS OBJC PERL6 SQLITE VB.NET |
Resource: | Advancement Autumn 2009, http://sevolymp.uuuq.com/ |