题目:
代码:
def gcd (a, b): return gcd(b, a % b) if b else a n = int(input()) nums = list(map(int,input().split(' '))) nums.sort() diff = [nums[i] - nums[i-1] for i in range(1,n)] temp = gcd(diff[0],diff[1]) for x in range(2,len(diff)): temp = gcd(temp, diff[x]) try: print(((nums[-1] - nums[0])//temp) + 1) except: print(len(nums))