流氓兔
发表于 2010-9-15 15:00
哦~~
sjs914915
发表于 2010-9-15 20:00
试试运气啦~~~~~~~~~~~
chxq666
发表于 2010-9-15 20:00
哦~~
myqlzx
发表于 2010-9-16 15:00
我要把这个帖子一直往上顶,往上顶!
wert
发表于 2010-9-16 20:00
强人,佩服死了。呵呵,不错啊
mathcd
发表于 2010-9-19 07:28
程序:
f := Module[
{tmp, s, p, i, lst, S},
tmp = (#1 + #2 + #3)/2 &;
lst = {};
For[i = 1, i <= y, i++,
p = RandomInteger;
s = tmp @@ p;
S = Sqrt & @@ p;
Which && Element && S != 0,
AppendTo];
];
lst
];
说明:
程序f采用随机算法。
第一个参数x:边长取值范围
第二个参数y:循环次数
例子:
f // MatrixForm
结果:
forum.php?mod=image&aid=88859&size=110x110&key=6d7cvhFm5%2FDqeEor2Xu4SVV0%2FyJxpsfV6T6GSeArPKNnvfMKvMQLC0A2&nocache=yes&type=fixnone
yellowaug
发表于 2010-9-19 23:37
C语言的?????
mathcd
发表于 2010-9-20 07:29
这里使Mathematica 版吧