Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,44 @@
|
|||
EnableExplicit
|
||||
|
||||
Procedure lexOrder(n, Array ints(1))
|
||||
Define first = 1, last = n, k = n, i
|
||||
If n < 1
|
||||
first = n
|
||||
last = 1
|
||||
k = 2 - n
|
||||
EndIf
|
||||
Dim strs.s(k - 1)
|
||||
For i = first To last
|
||||
strs(i - first) = Str(i)
|
||||
Next
|
||||
SortArray(strs(), #PB_Sort_Ascending)
|
||||
For i = 0 To k - 1
|
||||
ints(i) = Val(Strs(i))
|
||||
Next
|
||||
EndProcedure
|
||||
|
||||
If OpenConsole()
|
||||
PrintN(~"In lexicographical order:\n")
|
||||
Define i, j, n, k
|
||||
For i = 0 To 4
|
||||
Read n
|
||||
k = n
|
||||
If n < 1
|
||||
k = 2 - n
|
||||
EndIf
|
||||
Dim ints(k - 1)
|
||||
lexOrder(n, ints())
|
||||
Define.s ns = RSet(Str(n), 3)
|
||||
Print(ns + ": [")
|
||||
For j = 0 To k - 1
|
||||
Print(Str(ints(j)) + " ")
|
||||
Next j
|
||||
PrintN(~"\b]")
|
||||
Next i
|
||||
Input()
|
||||
End
|
||||
|
||||
DataSection
|
||||
Data.i 0, 5, 13, 21, -22
|
||||
EndDataSection
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue