吃葡萄那题其实很简单的。题目中说了数的范围是1到10^18,那么肯定是有线性求解的方法。下面是代码: import sys
if __name__ == "__main__":
t = int(input())
result = []
for i in range(t):
nums = list(map(int, sys.stdin.readline().strip().split()))
nums.sort()
a = nums[0]
b = nums[1]
c = nums[2]
total = a+b+c
avg = (a + b + c) // 3
res = 0
if total % 3 == 0:
res = avg
else:
res = avg + 1
if a+b < avg:
res = (c+1) // 2
result.append(res)
for i in range(t):
print(result[i])