int ret = 0 应该改为 ret = energy[0],当只要第一个为最大的时候比较不到。(虽然测试用例全过了,但示例2[-1,-2,-3,-4,-5]是过不了的)
2

相关推荐

牛客网
牛客网在线编程
牛客网题解
牛客企业服务