B
This commit is contained in:
parent
e5e8880e41
commit
518da4a923
1019 changed files with 15877 additions and 0 deletions
26
Task/Closest-pair-problem/BBC-BASIC/closest-pair-problem.bbc
Normal file
26
Task/Closest-pair-problem/BBC-BASIC/closest-pair-problem.bbc
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
DIM x(9), y(9)
|
||||
|
||||
FOR I% = 0 TO 9
|
||||
READ x(I%), y(I%)
|
||||
NEXT
|
||||
|
||||
min = 1E30
|
||||
FOR I% = 0 TO 8
|
||||
FOR J% = I%+1 TO 9
|
||||
dsq = (x(I%) - x(J%))^2 + (y(I%) - y(J%))^2
|
||||
IF dsq < min min = dsq : mini% = I% : minj% = J%
|
||||
NEXT
|
||||
NEXT I%
|
||||
PRINT "Closest pair is ";mini% " and ";minj% " at distance "; SQR(min)
|
||||
END
|
||||
|
||||
DATA 0.654682, 0.925557
|
||||
DATA 0.409382, 0.619391
|
||||
DATA 0.891663, 0.888594
|
||||
DATA 0.716629, 0.996200
|
||||
DATA 0.477721, 0.946355
|
||||
DATA 0.925092, 0.818220
|
||||
DATA 0.624291, 0.142924
|
||||
DATA 0.211332, 0.221507
|
||||
DATA 0.293786, 0.691701
|
||||
DATA 0.839186, 0.728260
|
||||
Loading…
Add table
Add a link
Reference in a new issue