@@ -0,0 +1,1945 @@
+package com.example.test;%0A%0A/**%0A *%0A * @author wangl%0A */%0Apublic class Daedalus %7B%0A%0A    public int calculateMaxYield(int%5B%5D strip) %7B%0A        for (int i : strip) %7B%0A            System.out.print(i);%0A            System.out.print(%22%5Ct%22);%0A        %7D%0A        System.out.println();%0A        this.maxYield(strip, 0);%0A        int yield = 0;%0A        for (int i : strip) %7B%0A            System.out.print(i);%0A            System.out.print(%22%5Ct%22);%0A            yield += i;%0A        %7D%0A        return yield;%0A    %7D%0A%0A    private void maxYield(int%5B%5D strip, int index) %7B%0A        if (strip.length == 0) %7B%0A            return;%0A        %7D%0A        if (strip.length == 1) %7B%0A            return;%0A        %7D%0A        if (strip.length == index + 2) %7B%0A            if (strip%5Bindex%5D %3C strip%5Bindex + 1%5D) %7B%0A                strip%5Bindex%5D = 0;%0A            %7D else %7B%0A                strip%5Bindex + 1%5D = 0;%0A            %7D%0A        %7D else if (strip.length == index + 3) %7B%0A            if (strip%5Bindex%5D + strip%5Bindex + 2%5D %3C strip%5Bindex + 1%5D) %7B%0A                strip%5Bindex%5D = 0;%0A                strip%5Bindex + 2%5D = 0;%0A            %7D else %7B%0A                strip%5Bindex + 1%5D = 0;%0A            %7D%0A        %7D else %7B%0A            if (strip%5Bindex%5D + strip%5Bindex + 2%5D %3C strip%5Bindex + 1%5D + strip%5Bindex + 1%5D) %7B%0A                strip%5Bindex%5D = 0;%0A                strip%5Bindex + 2%5D = 0;%0A                this.maxYield(strip, index + 3);%0A            %7D else %7B%0A                strip%5Bindex + 1%5D = 0;%0A                this.maxYield(strip, index + 2);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        Daedalus daedalus = new Daedalus();%0A        int%5B%5D strip1 = new int%5B%5D%7B206, 140, 300, 52, 107%7D;%0A        int yield1 = daedalus.calculateMaxYield(strip1);%0A        System.out.println(%22yield: %22 + yield1);%0A        System.out.println();%0A%0A        int%5B%5D strip2 = new int%5B%5D%7B147, 206, 52, 240, 300%7D;%0A        int yield2 = daedalus.calculateMaxYield(strip2);%0A        System.out.println(%22yield: %22 + yield2);%0A    %7D%0A%7D%0A

Create Daedalus.java