AT_code_festival_china_e Game

题目描述

在一款电子游戏中,共有 $N$ 个关卡,这些关卡分为 3 种难度等级,分别为 1, 2 和 3。 你需要完成三个不同难度等级的关卡数量分别为 $N_1, N_2, N_3$(其中 $N_1 + N_2 + N_3 = N$)。每种难度完成一关的概率分别是 $P_1, P_2, P_3$(以百分比表示)。 每次玩游戏需要支付 1 的费用。在一次游戏中,至少可以进行 1 个关卡的挑战,最多可以进行 4 个关卡的挑战。每轮挑战的顺序和数量如下: - 完成第一个关卡后,可以继续进行第二个关卡的挑战;若第一关失败,该次挑战结束。 - 完成第二个关卡后,可以继续进行最后一个关卡的挑战;若第二关失败,该次挑战结束。 - 完成最后一个关卡且难度为 2 或 3 时,可以继续进行额外关卡的挑战;若未满足条件,则该次挑战结束。 在每次挑战开始时,你可以自由选择任意未完成的关卡进行挑战,甚至可以重试已经完成的关卡。 例如,若你支付了 1 的费用并进行游戏,成功完成第一个关卡,但在第二个关卡失败,游戏即会结束,无法进行最后的关卡挑战。 你的目标是至少一次性完成所有 $N$ 个关卡。假设你选择了一种策略来最小化所需总费用,请计算达到这一目标所需的期望费用。

输入格式

输入包括以下内容: > $N_1$ $N_2$ $N_3$ $P_1$ $P_2$ $P_3$ - 第一行包含三个整数 $N_1, N_2, N_3\ (0 \leq N_1, N_2, N_3 \leq 100)$,依次表示每个难度等级的关卡数量。 - 第二行包含三个整数 $P_1, P_2, P_3\ (1 \leq P_1, P_2, P_3 \leq 100)$,依次表示成功完成每种难度的关卡的概率(百分比)。

输出格式

输出一个浮点数,表示在采取最佳策略以最小化总费用的情况下,完成所有关卡所需的期望费用。结果的绝对或相对误差需小于 $10^{-7}$。请在行末插入换行符。 **本翻译由 AI 自动生成**

说明/提示

### Problem There is a video game. In the game, there are $ N $ numbers of stages. There are $ 3 $ levels of difficulty and each stage has one of a difficulty in $ 1,2,3 $. The number of stages of each difficulty is $ N_1,N_2,N_3\ (N_1+N_2+N_3=N) $ For each difficulty, you know that the probability of completing the stage of that difficulty in one trial is $ P_1,P_2,P_3 $ (%). You have to pay cost $ 1 $ to play the game. In one gameplay, you can play at least $ 1 $ stage, and at most $ 4 $ stages. The number of stages you can play with cost $ 1 $ depends as following. - If you complete the first trial, you can continue to play the second trial. If you couldn't complete the first trial, that's the end of that play. - If you complete the second trial, you can continue to play the final trial. If you couldn't complete the second trial, that's the end of that play. - If you complete the final trial and also if the difficulty of that stage was $ 2 $ or $ 3 $, you can continue to play the extra trial. If not, that's the end of that play. Before starting each first, second, final, and extra trial, you may choose any stage of any difficulty to play. Also, you may choose the stage you have already completed before. For example, if you paid cost $ 1 $ and started the game, completed the first trial, and failed the second trial, that's the end of the play for that time. You can't play the final trial in that case. Your aim is to complete all the $ N $ stages at least $ 1 $ time each. Regarding you followed a optimal strategy to minimize the total cost, calculate the expected value of cost you must pay to achieve that. Whenever you choose the stage to play, you can choose any stage using the information about all stages you have tried including the stages you have completed at previous trial. ### Sample Explanation 1 There are $ 4 $ stages. you can surely complete the stage of any difficulty at once. Pay cost $ 1 $ to start the gameplay. For each trial, choose the stage as following and you can complete all the stages with no additional cost. - For the first trial, choose the stage of difficulty $ 1 $. - For the second trial, choose the stage of difficulty $ 1 $. - For the final trial, choose the stage of difficulty $ 3 $. - For the extra trial, choose the stage of difficulty $ 1 $.