哦~~
试试运气啦~~~~~~~~~~~
哦~~
我要把这个帖子一直往上顶,往上顶!
强人,佩服死了。呵呵,不错啊
程序:
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
C语言的?????
这里使Mathematica 版吧