Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Closest-pair-problem/Yabasic/closest-pair-problem.basic
Normal file
25
Task/Closest-pair-problem/Yabasic/closest-pair-problem.basic
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
minDist = 1^30
|
||||
dim x(9), y(9)
|
||||
x(0) = 0.654682 : y(0) = 0.925557
|
||||
x(1) = 0.409382 : y(1) = 0.619391
|
||||
x(2) = 0.891663 : y(2) = 0.888594
|
||||
x(3) = 0.716629 : y(3) = 0.996200
|
||||
x(4) = 0.477721 : y(4) = 0.946355
|
||||
x(5) = 0.925092 : y(5) = 0.818220
|
||||
x(6) = 0.624291 : y(6) = 0.142924
|
||||
x(7) = 0.211332 : y(7) = 0.221507
|
||||
x(8) = 0.293786 : y(8) = 0.691701
|
||||
x(9) = 0.839186 : y(9) = 0.728260
|
||||
|
||||
for i = 0 to 8
|
||||
for j = i+1 to 9
|
||||
dist = (x(i) - x(j))^2 + (y(i) - y(j))^2
|
||||
if dist < minDist then
|
||||
minDist = dist
|
||||
mini = i
|
||||
minj = j
|
||||
end if
|
||||
next j
|
||||
next i
|
||||
print "El par mas cercano es ", mini, " y ", minj, " a una distancia de ", sqr(minDist)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue