Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
24
Task/Permutation-test/XPL0/permutation-test.xpl0
Normal file
24
Task/Permutation-test/XPL0/permutation-test.xpl0
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
include xpllib; \For Print
|
||||
|
||||
int Data;
|
||||
|
||||
func Pick(At, Remain, Accu, Treat);
|
||||
int At, Remain, Accu, Treat;
|
||||
[if Remain = 0 then return if Accu > Treat then 1 else 0;
|
||||
return Pick(At-1, Remain-1, Accu + Data(At-1), Treat) +
|
||||
(if At > Remain then Pick(At-1, Remain, Accu, Treat) else 0);
|
||||
];
|
||||
|
||||
int Treat, GT, LE, I;
|
||||
real Total;
|
||||
[Treat:= 0; Total:= 1.;
|
||||
Data:= [85, 88, 75, 66, 25, 29, 83, 39, 97,
|
||||
68, 41, 10, 49, 16, 65, 32, 92, 28, 98];
|
||||
for I:= 0 to 8 do Treat:= Treat + Data(I);
|
||||
for I:= 19 downto 11 do Total:= Total * float(I);
|
||||
for I:= 9 downto 1 do Total:= Total / float(I);
|
||||
GT:= Pick(19, 9, 0, Treat);
|
||||
LE:= (fix(Total) - GT);
|
||||
Print("<= : %f% %d\n", 100. * float(LE) / Total, LE);
|
||||
Print(" > : %f% %d\n", 100. * float(GT) / Total, GT);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue