defcal(n, index): sum = 0 for i inrange(1, n): sum += i * i sum += n * index returnsum
if __name__ == '__main__': k = int(input()) # if k == 1: # print(1) p = k s = k * (k + 1) // 2 while k <= s: p = p - 1 s = p * (p + 1) // 2 # 检测在第三组第几个位置 nums = [] # print(nums) # print('p =', p) # print('s =', s) num = p * (p + 1) // 2 + 1 for i inrange(p + 1): nums.append(num) num += 1