第二题难道是我理解错了??为何就只过了两个TC。题意里边提供对切成30,15,10,6,5,3也是我们解题里能切对单位长度吧?
```
public static int maxProfit(int costPerCut, int salePrice, List<Integer> lengths) {
// Write your code here
int[] units = new int[]{30,15,10,6,5,3};
int max = Integer.MIN_VALUE;
for(int unit: units){
int piece = 0;
int total = 0;
for(Integer len : lengths){
int complete = len/ unit;
int mod = ((len % unit) != 0)? 1: 0;
if(salePrice * complete * unit - costPerCut * (complete+mod-1) <= 0) continue;
piece += complete;
total += (complete+mod - 1);
}
max = Math.max(max, salePrice * piece * unit - total * costPerCut);
}
return max;
}
```