数学吧 关注:911,366贴子:8,830,493

回复:一个由《植物大战僵尸》引发的数学问题

只看楼主收藏回复

人家不是模型都给你了吗,出黄油概率1-a^x


IP属地:湖北来自Android客户端16楼2023-10-26 02:56
收起回复
    黄油控制时间是三秒,只要黄油出现的最大周期小于3秒就没问题


    IP属地:辽宁来自Android客户端17楼2023-10-26 03:07
    收起回复
      2025-07-13 22:29:20
      广告
      明显不可能无穷
      假设有k个玉米炮,每次有3/4概率没有投掷黄油,既这k个玉米同时攻击时,有(3/4)^k都没有投掷黄油。不妨记为概率p不能同时投掷黄油
      就算p很小,在无穷时,p必然发生。
      那么再假设,同时出现的巨人总血量为x,玉米需要都不投掷黄油时,攻击n轮消灭巨人
      那么问题就变成,某事件发生概率为p,重复k次,出现至少连续n+1次p的概率是多少
      答案是,随着k的增加,连续n+1次p的概率是在增加的
      而无穷时,可以认为连续n+1次p必然发生


      IP属地:湖北来自Android客户端18楼2023-10-26 05:02
      收起回复
        这还不简单,只要血量能顶住玉米粒的伤害,那么巨人就有机会成功


        IP属地:陕西来自Android客户端19楼2023-10-26 06:42
        回复
          只要运气够好,一个玉米有机会杀死两亿血巨人


          IP属地:陕西来自Android客户端20楼2023-10-26 06:44
          收起回复
            狠狠拷打了gpt,写了个matlab脚本试试
            % Parameters
            corn_damage = 20;
            butter_damage = 40;
            attack_time = 2.9;
            butter_prob = 0.25;
            distance = 8;
            zombie_speed = 1/4.7;
            trap_time = 4;
            num_plants = 52;
            % Calculate the average rate of butter hits
            lambda_butter = butter_prob * num_plants / attack_time;
            % Calculate the average rate of corn hits
            lambda_corn = (1 - butter_prob) * num_plants / attack_time;
            % Test different zombie_HP values
            for zombie_HP = logspace(log10(3e8), log10(3e20), 100)
            % Initialize the zombie position and HP
            zombie_position = distance;
            zombie_HP_current = zombie_HP;
            % Initialize the time and the trap status
            time = 0;
            trapped = false;
            trap_end_time = 0;
            % Main loop
            while zombie_position > 0 && zombie_HP_current > 0
            % Calculate the time to the next hit
            hit_time = exprnd(1 / (lambda_butter + lambda_corn));
            % Update the time
            time = time + hit_time;
            % Check if the zombie is trapped
            if trapped && time < trap_end_time
            % The zombie is trapped, so it doesn't move
            else
            % The zombie is not trapped, so it moves
            zombie_position = zombie_position - zombie_speed * hit_time;
            trapped = false;
            end
            % Check if the hit is a butter hit
            if rand < butter_prob
            % It's a butter hit, so the zombie is trapped and loses HP
            zombie_HP_current = zombie_HP_current - butter_damage;
            trapped = true;
            trap_end_time = time + trap_time;
            else
            % It's a corn hit, so the zombie loses HP
            zombie_HP_current = zombie_HP_current - corn_damage;
            end
            end
            % Display the results
            if zombie_HP_current <= 0
            fprintf('For zombie_HP = %e, the plants defeated the zombie.\n', zombie_HP);
            else
            fprintf('For zombie_HP = %e, the zombie reached the plants.\n', zombie_HP);
            end
            end
            跑血量太慢了,明天起床再跑全部的,或者富哥v个i914900k也行
            代码有错误欢迎指正,毕竟是gpt写的


            IP属地:中国香港21楼2023-10-26 06:48
            收起回复
              无限对有限肯定是无限赢,说白了你根本没法定义怎么才算是能把一个无穷大血量的东西打死
              无限对无限永远不是“必然”或者“不可能”,只能说“概率为0”或者“为1”


              星座王
              点亮12星座印记,去领取
              活动截止:2100-01-01
              去徽章馆》
              IP属地:山西来自Android客户端22楼2023-10-26 07:07
              收起回复
                算个期望值就好了


                IP属地:浙江来自iPhone客户端23楼2023-10-26 07:22
                回复
                  2025-07-13 22:23:20
                  广告
                  既然是数学问题,首先就要确切定义一下什么是无穷血量和无穷玉米。
                  如果是趋近无穷,那么它随玉米数量的增加是线性增长还是指数增长或者对数增长?如果这两个值之间不存在明确的函数关系,那只能抱歉,数学不负责解决这种问题。
                  如果是字面意义上的打了不扣血,那么结论就是无论多少玉米都打不死。


                  IP属地:上海来自Android客户端24楼2023-10-26 07:22
                  回复
                    表述有问题吧,应该说有百分之多少的把握能够击败血量为xx的僵尸。🙊有多少把我那就是无限血量了。


                    IP属地:四川来自Android客户端26楼2023-10-26 07:39
                    回复
                      什么是无限


                      IP属地:山东来自Android客户端27楼2023-10-26 07:52
                      收起回复
                        不是说在数学上,小于5%就被认为是不可能吗?不懂,我一个同学跟我说的,跟我读的不是一个专业


                        IP属地:四川来自Android客户端28楼2023-10-26 07:53
                        收起回复
                          数学上无穷是用普通有限数定义的,一个无穷只要不断加大求极限,提到两个以上的无穷需要给出具体增长函数


                          IP属地:山东来自Android客户端29楼2023-10-26 07:57
                          回复
                            我觉得应该是一个比较简单的指数分布,因为玉米投出的黄油是柏松分布,因此事件间时间间隔就是指数分布


                            IP属地:美国来自iPhone客户端30楼2023-10-26 07:57
                            回复
                              2025-07-13 22:17:20
                              广告
                              但投黄油实际上也不是完全随机,所以实操能一直控下去


                              IP属地:山东来自Android客户端31楼2023-10-26 07:58
                              收起回复