Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 additions and 0 deletions
32
Task/Closest-pair-problem/Ring/closest-pair-problem.ring
Normal file
32
Task/Closest-pair-problem/Ring/closest-pair-problem.ring
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
decimals(10)
|
||||
x = list(10)
|
||||
y = list(10)
|
||||
x[1] = 0.654682
|
||||
y[1] = 0.925557
|
||||
x[2] = 0.409382
|
||||
y[2] = 0.619391
|
||||
x[3] = 0.891663
|
||||
y[3] = 0.888594
|
||||
x[4] = 0.716629
|
||||
y[4] = 0.996200
|
||||
x[5] = 0.477721
|
||||
y[5] = 0.946355
|
||||
x[6] = 0.925092
|
||||
y[6] = 0.818220
|
||||
x[7] = 0.624291
|
||||
y[7] = 0.142924
|
||||
x[8] = 0.211332
|
||||
y[8] = 0.221507
|
||||
x[9] = 0.293786
|
||||
y[9] = 0.691701
|
||||
x[10] = 0.839186
|
||||
y[10] = 0.728260
|
||||
|
||||
min = 10000
|
||||
for i = 1 to 9
|
||||
for j = i+1 to 10
|
||||
dsq = pow((x[i] - x[j]),2) + pow((y[i] - y[j]),2)
|
||||
if dsq < min min = dsq mini = i minj = j ok
|
||||
next
|
||||
next
|
||||
see "closest pair is : " + mini + " and " + minj + " at distance " + sqrt(min)
|
||||
Loading…
Add table
Add a link
Reference in a new issue