範囲に収まる数字の数(Pythonの場合)
#! /user/local/bin/python num = [] chohuku =0 for line in open ('../data_d.txt','r'): if line == 0: break else: num.append(int(line)) width = num.pop(0); num.sort(lambda x, y: y-x) maxTimes =0 for i in range(len(num)-1): target = 0 for j in range(len(num)-i): if num[i] - num[i+j] < width+1: target += 1 else: break if maxTimes < target: maxTimes = target print maxTimes