Đáp án bài ABSMAX
Link bài: https://lqdoj.edu.vn/problem/absmax
l = input()
sq = list(map(int, input().split()))
sq.sort()
a = sq[0]
b = sq[1]
c = sq[-1]
d = sq[-2]
if abs(a+b) > abs(c+d):
print(abs(a+b))
else:
print(abs(c+d))
Link bài: https://lqdoj.edu.vn/problem/absmax
l = input()
sq = list(map(int, input().split()))
sq.sort()
a = sq[0]
b = sq[1]
c = sq[-1]
d = sq[-2]
if abs(a+b) > abs(c+d):
print(abs(a+b))
else:
print(abs(c+d))
Bình luận