Sobes.tech
Intern

D. Valera and vending machines In a business center, there are 10 externally identical vending machines with chocolates. Each machine dispenses a chocolate with its own fixed probability, which is initially unknown and may differ between machines. Sweet-tooth Valera wants to get as many chocolates as possible, but his budget is limited to 200 tugrik. Each purchase attempt (using any machine once) costs exactly 1 tugrik — payment is made regardless of whether the machine dispenses a chocolate or not. Valera, trying to learn the probabilities of the machines, met security guard Alexei, who shared an important piece of information. The guard told him that 2/5 of the machines have probabilities drawn from a uniform distribution on [0.2, 0.3], 2/5 from [0.4, 0.5], and the rest from [0.85, 1]. Your task is to devise an algorithm that helps Valera get as many chocolates as possible. Interaction protocol This is an interactive task. Your program should first output the number of the machine — a number from 0 to 9. Then the system (interactor) will return the result: 1 if a chocolate was dispensed, or 0 if not. Your program can read this value (for example, via input()) to use in further calculations. Scoring system In each test, the percentage of successful attempts to get chocolates will be evaluated. If this percentage exceeds 75%, the test is considered passed. Note It is recommended to use Python 3.8 (Handbook DS) as the compiler.