Retired
Stingy Machinations (retired)
15eptaceps
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 as45.43
, while45.423
as45.42
. -
r_price
will be a float number between0.00
and50000.00
included -
n
will be an int number between2
and1000
included
My other Katas :
Table BuilderExplosive Table
Techno Barman
Odd-Even Compositions
any reference to people or things is purely coincidental.
Fundamentals
Mathematics
Algorithms
Logic
Numbers
Similar Kata:
Stats:
Created | Oct 30, 2021 |
Warriors Trained | 17 |
Total Skips | 0 |
Total Code Submissions | 21 |
Total Times Completed | 15 |
Python Completions | 15 |
Total Stars | 0 |
% of votes with a positive feedback rating | 25% of 12 |
Total "Very Satisfied" Votes | 3 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 13 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |