Retired

Stingy Machinations (retired)

Description:

Plot

Mr Ping and some of his friends want to buy a gift for a person.
However Mr Ping is stingy and smart as a lynx, and thus said that he would be the one to buy the gift.
Then the price would be divided equally between the participants.

Mr Ping said so in order to have the opportunity to make others pay more than they should, so that he would have nothing to pay.

For example, if the gift costs 10€ and there are 5 participants, Mr Ping included, everyone would have to pay 2€; but being him stingy (and smart) he would make them pay 2.50€ saying that the gift costed 12.50€.

Task

Given the real price of the gift, calculate the price that Mr Ping should propose to the other participants so that Mr Ping has nothing to pay.
input :
-) r_price   # the real price of the gift
-) n         # the number of participants (Mr Ping included)

output :
-) p_price   # the price told them by Mr Ping

Examples

stingy_machinations(10.00, 5) == 12.50

stingy_machinations(25.50, 6) ==  30.60

Notes

  • The result should be rounded after 2 decimal digits, for example 45.429 should be returned as 45.43, while 45.423 as 45.42.

  • r_price will be a float number between 0.00 and 50000.00 included

  • n will be an int number between 2 and 1000 included

My other Katas :

Table Builder
Explosive Table
Techno Barman
Odd-Even Compositions

any reference to people or things is purely coincidental.

Fundamentals
Mathematics
Algorithms
Logic
Numbers

More By Author:

Check out these other kata created by eptaceps

Stats:

CreatedOct 30, 2021
Warriors Trained17
Total Skips0
Total Code Submissions21
Total Times Completed15
Python Completions15
Total Stars0
% of votes with a positive feedback rating25% of 12
Total "Very Satisfied" Votes3
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes9
Total Rank Assessments13
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • eptaceps Avatar
Ad