Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
31
Task/Permutation-test/FreeBASIC/permutation-test.basic
Normal file
31
Task/Permutation-test/FreeBASIC/permutation-test.basic
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
Dim Shared datos(18) As Integer => {85, 88, 75, 66, 25, 29, 83, 39, 97,_
|
||||
68, 41, 10, 49, 16, 65, 32, 92, 28, 98}
|
||||
|
||||
Function pick(at As Integer, remain As Integer, accu As Integer, treat As Integer) As Integer
|
||||
If remain = 0 Then
|
||||
If accu > treat Then Return 1 Else Return 0
|
||||
End If
|
||||
|
||||
Dim a As Integer
|
||||
If at > remain Then a = pick(at-1, remain, accu, treat) Else a = 0
|
||||
Return pick(at-1, remain-1, accu+datos(at), treat) + a
|
||||
End Function
|
||||
|
||||
Dim As Integer treat = 0, le, gt, total = 1, i
|
||||
|
||||
For i = 1 To 9
|
||||
treat += datos(i)
|
||||
Next i
|
||||
For i = 19 To 11 Step -1
|
||||
total *= i
|
||||
Next i
|
||||
For i = 9 To 1 Step -1
|
||||
total /= i
|
||||
Next i
|
||||
|
||||
gt = pick(19, 9, 0, treat)
|
||||
le = total - gt
|
||||
|
||||
Print Using "<= : ##.######% #####"; 100*le/total; le
|
||||
Print Using " > : ##.######% #####"; 100*gt/total; gt
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue