from typing import List
# 这道题较为非常容易,遍历一遍k 1就好了,
# 能够算出全部的結果 ,可是会有重复值,因而必须将重复值排除
# 另外防止商场
class Solution:
def divingBoard(self, shorter: int, longer: int, k: int) -> List[int]:
# 界定一个目录,用于接受全部的結果
num_list = []
# 当k为0时 ,必须回到空目录
if k == 0:return []
# 遍历,并计算全部的值
for index1 in range(k 1):
num = shorter * index1 (k - index1) * longer
num_list.append(num)
# 先排列
num_list.sort()
tem = []
index = 1
tem.append(num_list[0])
# 随后排除全部的重复值
while index < len(num_list):
if num_list[index] != num_list[index - 1]:
tem.append(num_list[index])
index = 1
else:
index = 1
continue
return tem
A = Solution()
print(A.divingBoard(1,1,100000))
文章来源于网络,如有侵权请联系站长QQ61910465删除
本文版权归qu快排seo www.sEoguRuBlog.com 所有,如有转发请注明来出,竞价开户托管,seo优化请联系QQ√61910465