2013-04-17 14:34:39 +08:00

22 lines
390 B
Python

a = {}
for i in xrange(1, 1000):
for j in xrange(i, 1000):
tmp = i * i + j * j
sqr = int(tmp ** 0.5)
if tmp == sqr * sqr and i + j + sqr <= 1000:
tt = i + j + sqr
if a.keys().count(tt):
a.update({tt: a.get(tt) + 1})
else:
a.update({tt: 1})
mm = [0, 0]
for i in a.keys():
if a.get(i) > mm[1]:
mm[0] = i
mm[1] = a.get(i)
print mm