Equality
Practice
0 (0 votes)
Easy
Problem
67% Success 312 Attempts 20 Points 0.75s Time Limit 256MB Memory 1024 KB Max Code

Long into the future:
Udit is known as Mr. Gulati and with his superior coding skills he has made his way into Google.Recently upper
management of Google is impressed by the work done by Mr. Gulati's team and has decided to gift the team with some
shares. Now Gulati being a practical person, he wants to divide shares to team members by following the strategy of
Equity i.e the shares should be divided according to the work done by person . But as we know what happens with
practical approaches , proposal of Mr. Gulati was turned down by management and he was asked to divide the shares
by following the strategy of Equality i.e treat everyone the same.

You can't do something you can't believe in hence Udit wasn't able to do the task and hence he asks you for help.
Help Udit by telling him how the shares should be divided.

Dividing by following the stratergy of Equality means that shares should be divided using the approach that everyone must get equal
number of shares. But sometime's it isn't possible to divide the shares in such a way that everyone have equal
number of shares hence you have to divide the shares in such a way that division is as fair according to equality
as possible(Difference between shares given to any two person's is minimum). See examples for understanding.

 

Input format :

First line will contain an integer T i.e. number of test cases.
for each test case:
You will be given with two integers m and n. m is number of shares and n is number of people including
Udit among whose the shares are to be divided.

 

Output Format :

You have to print the n space sperated integers in increasing order per test case telling how the shares to
be divided.

 

Constraints :

\(1 \leq T \leq 10^5\)

\(1 \leq m \leq 10^{18}\)

\(1 \leq n \leq 10^5\)

 

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
3 votes
Tags:
ObservationBasic MathAlgorithmsBasics of Greedy AlgorithmsMath
Points:20
1 votes
Points:20
5 votes
Tags:
Ad-HocEasyMathematicsSieveOpenApprovedMathamatics