HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Contests > IMPC-2014-15 Questions > problem:


Ind_04-10. 50787 - Expected Value

IMPC-2014-15 Questions

Start: Nov.22.2014 at 03:00:00 PM
Finish: Nov.22.2014 at 08:00:00 PM
The contest is finished!
• Contest scoreboard

Guest
• Review clarifications (1)

Contest problems

• Ind_01-50. 50718 - Elevator
• Ind_02-10. 50497 - Falling Bricks - ...
• Ind_02-20. 50745 - Bitonic Sequence
• Ind_02-30. 50657 - Permutations an...
• Ind_03-10. 50743 - Total Scholarshi...
• Ind_03-20. 50515 - Lines - Revisited
• Ind_03-40. 50777 - Dwarfs Maze
• Ind_03-50. 50679 - Jetpack Hurdle J...
• Ind_04-10. 50787 - Expected Va...
• Ind_04-20. 50520 - Filling a Matrix ...
• Ind_04-30. 50658 - The Message

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:

  1. Project success percentage: an integer between 0 and 100
  2. The amount you win in case of success: an integer between 0 and 10,000
  3. The amount you lose in case of failure: an integer between 0 and 10,000

Output specification
Show two information

  1. the highest expected value (with two digits precision)
  2. 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,

  1. Project #1, you would probably get $19.55
  2. Project #2, you would probably get $38.70
  3. Project #3, you would probably lose $13.92
  4. Project #4, you would probably get $24.08
  5. 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)


Для отправки решений необходимо выполнить вход.

www.contester.ru