解决此题的关键是使用break和continue语句
再一是理解题意这句话,给出的是甲、乙两人的酒量(最多能喝多少杯不倒),而让输出的阈值是,输出先倒下的那个人,即喝的杯数是要大于酒量而不是大于等于。
代码如下:
n,m = map(int,input().split())
N = int(input())
last_shule = None
A_he = 0
B_he = 0
for i in range(N):
Ahan,Ahua,Bhan,Bhua = map(int,input().split())
num = Ahan+Bhan
if num == Ahua and num != Bhua:
shule = "A"
A_he += 1
if A_he > n:
print(shule)
print(B_he)
break
elif num != Ahua and num == Bhua:
shule = "B"
B_he += 1
if B_he > m:
print(shule)
print(A_he)
break
else:
continue