Feedback | If you notice incorrect translations in Contester, please let author know.
|
|
Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. Question by Ibrahim Mesecan.
Expected Value
You are to open shop and you
cannot decide either to open a candy shop
or to open a lemonade stand. If you open
a candy shop you would probably get $100.
And, if you open a lemonade stand, you
would probably get $90. In this case you
would choose to open a candy shop, because
you would earn more money.
But what happens if there is 50% of success
when a candy shop is opened. And, if you succeed
you would probably get $100, and if you fail,
you would probably lose $30.Similarly for the
lemonade stand,
if there is 50% of success when it is opened.
If it's a success you would probably earn $90,
and if it's a failure you would probably lose
$10.
In such cases, you can calculate the expected
values of the projects with the following:
Expected Value =(Probability of Success)*(the amount you win) -
(Probability of Failure)*(the amount you lose)
Then for the candy shop,
Expected Value =(50%)*($100) - (50%)*($30) = $35
And for the lemonade stand,
Expected Value =(50%)*($90) - (50%)*($10) = $40
The expected value of lemonade stand is $40.
Then, you would most probably choose the lemonade stand.
Question:
Write a program that is going to get information for
n projects and calculate and show the most profitable
project for you.
Input specification
You will be given an integer in the beginning: the
number of projects (n). you will be given three integers:
- Project success percentage: an integer
between 0 and 100
- The amount you win in case of success:
an integer between 0 and 10,000
- The amount you lose in case of failure:
an integer between 0 and 10,000
Output specification
Show two information - the highest expected
value (with two digits precision)
- the id of that project.
Note:
If there are several projects with the same
expected values, show the ID of the first one.
Sample Input I
5
89 30 65
77 64 46
28 48 38
68 50 31
39 17 30
|
Sample Output I
38.70 2
|
Explanation:
There are 5 projects given If you start project,
- Project #1, you would probably get $19.55
- Project #2, you would probably get $38.70
- Project #3, you would probably lose $13.92
- Project #4, you would probably get $24.08
- Project #5, you would probably lose $11.67
So, the most profitable project is #2 with an expected value
of 38.70 (0.77*64 - 0.23*46)
Для отправки решений необходимо выполнить вход.
|