Submit | All submissions | Best solutions | Back to list |
ROBBERY2 - Robbery 2 |
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, and 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
106 ≤ n ≤ 1015
2 ≤ k ≤ 100
Output
For each test print the amounts of coins each bandit gets separated by spaces.
Example
Input: 3 1000000 2 1234567 3 123456789 4 Output: 499849 500151 411602 411887 411078 30869901 30858368 30862296 30866224
Added by: | Spooky |
Date: | 2010-03-09 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC PERL6 SQLITE VB.NET |
Resource: | Advancement Spring 2010, http://sevolymp.uuuq.com/ |
hide comments
|
||||||
2015-06-10 07:05:57 i_am_looser
Easy math |
||||||
2015-06-04 12:45:53 Arafat dad Khan
Useless problem, don't waste your time with this |
||||||
2015-05-25 17:17:06 :.Mohib.:
AC... nice que!! :) |
||||||
2015-03-14 09:52:38 D Pratap
Good problem description .. Given test cases are enough to test accuracy of implemented logic |
||||||
2014-01-16 17:11:51 Rajat Goyal
easy mathematics Last edit: 2014-01-16 17:12:27 |
||||||
2014-01-09 06:17:37 KESHAV BANSAL
pls check y i am getting tle can't figure it out @ code id 10829623 |
||||||
2013-08-05 14:24:17 Ayush Vatsa
Atlast AC:) |
||||||
2013-07-30 21:32:31 ROHIT KUMAR
TLE sucks :( but finally AC in 0.06 sec :) :) gud 1 |
||||||
2013-07-25 19:26:18 Ayush Vatsa
TLE can be so depressing :( |
||||||
2013-07-17 17:34:58 Vipul Pandey
just maths. |