#做完美团2023秋招笔试,你还好吗#8.20美团第三题求复习的最大期望:使用01背包解决,各位大佬看看是否能acpackage main;import java.util.*;public class Main{ public static void main(String[] args) { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int m=sc.nextInt(); double[] que=new double[n]; double[] score=new double[n]; for(int i=0;i que[i]=sc.nextDouble(); } for(int i=0;i score[i]=sc.nextDouble(); } double[] dp=new double[m+1]; double sum=0; for(int i=0;i sum+=1.0*que[i]*score[i]/100; } for(int i=0;i dp[i]=sum; } for(int i=0;i for(int j=m;j>=1;j--){ dp[j]=Math.max(dp[j],dp[j-1]+score[i]-1.0*que[i]*score[i]/100); } } System.out.printf("%.2f",dp[m]); }}#美团笔试#