三角形顶点 - Lua计算?
问题描述:
我目前决心在Lua完成一个问题,并且不知道从哪里开始。我正在考虑从模数运算符开始。我正在寻找有经验的Lua程序员关于如何编程的建议,主要是我如何计算问题的理论数学方面。三角形顶点 - Lua计算?
Source of the question... (http://www.eecs.qmul.ac.uk/~pbo/ACM/archive/00209.html)
感恩会显示给任何人谁回答正确。 谢谢你。
答
function get_left(max)
i = 0
j = 1
ls = {}
repeat
i = i + 1
j = j + i - 1
ls[i] = j
print (ls[i], " ls")
until j >= max
return ls
end
a = get_left(27)
(需要格式化为代码-.-)
if the point1 is between a[i] and a[i+1]
if then point2 is still between a[i] and a[i+1] it is on the same line
else if point2 is between a[i + n] and a[i + n + 1]
then if point2 is at a[i + n] + (a[i] - point1) + n + 1 its in a strait line right above it
else if point2 is at a[i + n] + (a[i] - point1) + n - 1 its in a strait line left above it
if for all points n or n*(-1) is equal the distance between the points is equal.
也就是说,如果我没有做任何逻辑错误,你可能要检查更多的钱才能正常工作。
这是一个比卢阿更数学的问题,我建议给它添加一个数学标签。