晓屁屁
发表于 2018-6-1 16:29:08
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
if x + y*y == z*z*z:
print(x,y,z)
else:
pass
小恒小小恒
发表于 2018-6-1 17:07:34
不会啊
悠斗
发表于 2018-6-1 17:36:59
using System;
namespace 数学题
{
class Program
{
static void Main(string[] args)
{
int x=0, y=0, z=0;
int sum_z = 0, sum_y = 0;
for (x = 1; x < 101; x++)
for (y = 1; y < 101; y++)
for (z = 1; z < 101; z++)
{
sum_z = z * z * z;
sum_y = y * y;
if (sum_z == (sum_y + x))
Console.WriteLine("{0},{1},{2}",x,y,z);
}
Console.WriteLine("Hello World!");
Console.ReadLine();
}
}
}
顺德热心市民
发表于 2018-6-1 19:51:01
1.
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
if x + y*y == z**3:
print(x, '\t',y, '\t',z)
2.
x = range(1,101)
y = range(1,101)
z = range(1,101)
key = [ (a , b , c ) for a in x for b in y for c in z if ( a + b * b == c ** 3 )]
for each in key:
print (each)
冰封雪舞
发表于 2018-6-1 20:23:59
for i in range(1,100):
for y in range(1,100):
for x in range(1,21):
if i==x**3-y**2:
print(i,y,x)
天圆突破
发表于 2018-6-1 23:24:09
本帖最后由 天圆突破 于 2018-6-1 23:35 编辑
for j in range(1, 101):
if j*j*j > 10000:
break
for i in range(1, 101):
if i*i >= j*j*j:
break
if i*i < j*j*j - 100:
continue
print(j*j*j-i*i, i, j)
asdfg5954457
发表于 2018-6-2 00:55:02
maxZ = int((100**2+100)**(1/3))
for eachZ in range(1,maxZ+1):
maxY = int((eachZ**3)**0.5)
for count in range(maxY):
Y = maxY - count
if (eachZ**3 - Y**2) <= 100 and (eachZ**3 - Y**2) >= 1:
print('%d %d %d' %(eachZ**3 - Y**2,Y,eachZ))
else:
break
有點小作弊的感覺
ucnewbie
发表于 2018-6-2 03:54:06
for x in range (1, 101):
for y in range (1, 101):
for z in range (1, 101):
if x+y**2 == z**3:
print (x, y, z)
秋之临
发表于 2018-6-2 08:56:46
想看下最佳答案{:5_109:}
堕落之翼
发表于 2018-6-2 09:38:51
import math
for z in range(1,math.ceil(math.pow(10100,1/3))):
for y in range(1,101):
x = pow(z,3) - pow(y,2)
if 0< x < 101:
print(x,y,z)
else:
break
475123763
发表于 2018-6-2 10:16:38
我脑袋
所向故往
发表于 2018-6-2 10:25:31
解法一:
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
if (x + y*y == z * z * z):
print(x,y,z)
解法二:
import itertools
a = range(1,101)
y = list(itertools.permutations(a,3))
for x in y:
if (x + x* x == x * x * x):
print(x,x,x)
结果。。。
调用itertools模块后的第二种解法用时是第一种复杂度n^3用时的一倍{:10_266:}。
请求回答
发表于 2018-6-2 10:50:42
for x in range(1,101):
for y in range(1,101):
for z in range(1,23):
if x+y**2-z**3==0:
print('%d %d %d' % (x,y,z))
未来肌肉男
发表于 2018-6-2 12:44:02
{:10_249:}
lan358088
发表于 2018-6-2 14:07:37
本帖最后由 lan358088 于 2018-6-2 14:08 编辑
for x in range (1,100):
for y in range (1,100):
for z in range (1,100):
if x+y*y==z*z*z:
print (x, y, z)
鱼鱼鱼鱼世无争
发表于 2018-6-2 14:28:21
for x in range(1,101):
for y in range(1,101):
for z in range(1,101):
if (x + y**2 == z**3):
print(x,y,z)
九宫
发表于 2018-6-2 15:40:43
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
if x+y**2==z**3:
print(x,y,z)
shoufei
发表于 2018-6-2 19:03:01
for x in range(1,100):
for y in range(1,100):
for z in range(1,100):
a = x + pow(y,2) - pow(z,3)#pow(x,y[.z]),返回X的y次幂(有z则对z取模)
if a == 0:
print("%d%d%d \r\n" % (x,y,z))
安南蒲
发表于 2018-6-2 22:19:05
for x in range(1,101,1):
for y in range(1,101,1):
for z inrange(1,101,1):
if (x) == (z ** 3 - y ** 2):
print(x,y,z,'\n')
sycor6366
发表于 2018-6-2 22:49:01
>>> for i in range(1,101):
for y in range(1,101):
for z in range(1,101):
print(i,y,z)