Java- generates rankings based on the total number of winners

condition:
Total number of winners

demand:
generate a set of rankings based on the total number of winners, which adds up to 100% (the percentage of people x in each ranking)

example as shown in the figure:
the number of winners is 50. A set of rankings are generated, followed by the percentage of the ranking, and then the corresponding bonus
, the higher the ranking, the greater the percentage of the bonus, that is, the more money the br > ranking is randomly generated. I can write it out. But to ensure that the latter percentage is getting smaller and smaller and add up to 100, it will be difficult for me
I don"t know how to put forward a common factor or more to generate
and ask the bosses to give me some advice!

Aug.27,2021

your problem can be described in mathematical language like this:

sets the total number of bonuses as 100, and now N individuals divide the bonuses into 13 different levels. A1 individuals receive the first level bonus, a2 individuals receive the second level bonus, A13 individuals receive the 13th level bonus, then the above figure should satisfy the following formula:
a1*x1 + a2*x2 +. + a13*x13 = 100
A1 + A2 +. + a13 = N = 50
so your question should have two inputs: N and 13 levels of bonus, that is, x1 = 15 code x2 = 10 x3 = 8. , or the mathematical relationship between xn and xn+1 .
the output should be: A1 = 1Magi a2 = 1Magi a3 = 1,., A13 =?

what common factor is mentioned? isn't the percentage of bonus for the first place and the second place not the configured

?
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb3a3f-2474.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb3a3f-2474.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?