- 论坛徽章:
- 0
|
题目大意如下:
找出满足 a = x^3 + y^3 + z^3 和 a = m^3 + n^3 + o^3 的 a 及其 x,y,z,m,n,o 的正整数值,其中 1 flag={}
for x in range(1,100):
for y in range(x+1,100):
for z in range(y+1,100):
a=x*x*x+y*y*y+z*z*z
xyz="(%2d,%2d,%2d)" % (x,y,z)
if a=1000000:
if a in flag:
mno=flag.get(a)
flag[a]=xyz + " vs " + mno
else:
flag[a]=xyz
#for k,v in flag.iteritems():
# if v.find("vs") != -1:
# print k, v
for i in range(1,1000000):
if i in flag:
xyzmno = flag.get(i)
if xyzmno.find("vs") != -1:
print "%7d %s" % (i, xyzmno)
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/24581/showart_1196120.html |
|