Python Code:
s=[]
for x in range(1,4):
for y in range(1,4):
for z in range(1,4):
s.append([x,y,z])
flag=0
z=[]
for i in range(len(s)-2):
for j in range(i+1,len(s)-1):
for k in range(j+1,len(s)):
a1=(s[i][0]-s[j][0])**2+(s[i][1]-s[j][1])**2+(s[i][2]-s[j][2])**2
a2=(s[i][0]-s[k][0])**2+(s[i][1]-s[k][1])**2+(s[i][2]-s[k][2])**2
a3=(s[j][0]-s[k][0])**2+(s[j][1]-s[k][1])**2+(s[j][2]-s[k][2])**2
if a1==a2 and a2==a3:
flag+=1
print(s[i],s[j],s[k])
print(flag)
答案:80個
沒有留言:
張貼留言