爱奇艺最长广告时间长度的题
def helper(cand, occupied_len): if occupied_len>T: return res.add(occupied_len) for i in range(len(cand)): helper(cand[i+1:], occupied_len + cand[i]) while True: arr = [int(i) for i in raw_input().split(' ')] if len(arr)==1: break T = arr[0] N = arr[1] T_arr = arr[2:] T_arr.sort() res = set() helper(T_arr, 0) print max(res)
麻烦哪位大神指明下我哪里做错了,一直是80%