# -*- coding:utf-8 -*-s, n = 0 ,1print('n s')while True:s += n * nif s > 1000:breakprint(n,' ',s)n += 1print('*'*30)print('累积和不超过1000的最大项数是%d'%n)