. - 力扣(LeetCode)

 
from itertools import count
 
 
class Solution:
	# 使用枚举法
	def maxHeightOfTriangle(self, red: int, blue: int) -> int:
		cnt = [0, 0]
		for i in count(1):
			cnt[i % 2] += i
			if (cnt[0] > red or cnt[1] > blue) and (cnt[0] > blue or cnt[1] > red):
				return i - 1