Arunima City

TarifEzaz EWU Team Programming Batt...
Limits 1.5s, 512 MB

After the big decentralization process, where Dhaka city's population were relocated, a new city called Arunima is born! After a quick census, it was found that in Arunima, there are n poor people and m rich people. Unfortunately, the economic condition is so imbalanced that the rich people have infinite amount of money and the poor people have absolutely nothing. In order to make the economic condition of the entire city stable, the city corporation decided to ask the rich inhabitants to give some donation to the poor. Even though the rich inhabitants have infinite amount of money, they will not give an infinite amount away. So, the city corporation decides the following scheme:

The rich population are numbered from 1 to m and the poor population are numbered from 1 to n. Every i-th rich person will give away money to each of the poor person. The j-th poor person will get ( j mod i ) amount of money from the i-th rich person. Here, the mod operation gives the remainder, when j is divided by i.

Given n and m, you have to determine, how much money each rich person will end up giving.


The only line of the input contains two integers n ( 1<= n <= 106 ) and m ( 1 <= m <= 105 ), denoting the number of poor and rich people respectively in the Arunima city.


Output a single line, containing m space separated integers, where the i-th number indicates the amount of money given by the i-th rich guy.


5 3
0 3 6


Login to submit.


64% Solution Ratio
BugXterminatorEarliest, Jun '16
AungkurFastest, 0.0s
BugXterminatorLightest, 262 kB
mdvirusShortest, 122B
Toph uses cookies. By continuing you agree to our Cookie Policy.