ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Поиск > задача:


50787 - Expected Value

Гость
• Вопросы к жюри (1)

Задачи раздела

• Raporti Javor
• 50861 - The largest Student Group
• 50815 - Breaking the Bunker
• 50437 - Age Labeling
• 50500 - Find Student
• 50786 - Top Question
• 50788 - Eight Puzzle
• 50504 - School contest
• 50787 - Expected Value
• 50859 - Low performance
• 50785 - Swimming Contest
• 50826 - Olive Containers
• 50866 - Buy the cheapest
• 50999 - Overlapping Trips
• 50507 - Sequential Numbers
• 50501 - The Highest Average
• 50434 - Row Min Subtraction

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
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