static int pick(int[] peaches) { int dp[]=new int[peaches.length]; for(int i=0;i<dp.length;i++){ dp[i]=0; } int maxSum=0; for(int i=0;i<peaches.length;i++){ int count=1; int temp=0; for(int j=i;j<peaches.length;j++){ if(count<dp[j]){ break; }else { if(peaches[j]>temp){ if(count>dp[j]){ dp[j]=count; if(count>maxSum){ maxSum=count; } }else { break; } count++; temp=peaches[j]; } } } } return maxSum; } 为什么只通过了40%,TT,哪位大佬看下==
点赞 评论

相关推荐

12-20 11:21
复旦大学 Java
点赞 评论 收藏
分享
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务