Write a function which takes in a list of positive integers and returns a list of integers approximating the percent of total for the corresponding integer in the same position.
All integers in the return list must exactly add up to 100. You can assume the sum of integers passed in is greater than 0. How you want to round or truncate decimals is up to you as long as any single resulting integer returned as a percentage is off by no more than 1 in either direction.
p([1,0,2]) -> [33,0,67] or [34,0,66] p([1000,1000]) -> [50,50] p([1,1,2,4]) -> [12,12,25,51] or [13,12,25,50] or [12,13,25,50] or [12,12,26,50] p([0,0,0,5,0]) -> [0,0,0,100,0]
This is code-golf, so shortest code in bytes wins!