|
|
back to boardrunntime error test1 Posted by ilUha 14 Apr 2019 22:59 import math am=int(input()) sum_wght=0 stns=[] #ideal=0 fhp=0 shp=0 res=0 for i in range(am): st=int(input()) sum_wght+=st stns.append(st) #ideal=sum_wght//2 stns.sort() #print(stns) fhp+=max(stns) stns.pop() stns.reverse() for i in range(len(stns)): #print('1hp:',fhp,'2hp:',shp) if fhp>shp: shp+=stns[i] else: fhp+=stns[i] res=int(math.fabs(fhp-shp)) print(res)
|
|
|