21 lines
649 B
Plaintext
21 lines
649 B
Plaintext
constant data = {85, 88, 75, 66, 25, 29, 83, 39, 97,
|
|
68, 41, 10, 49, 16, 65, 32, 92, 28, 98 }
|
|
|
|
function pick(int at, int remain, int accu, int treat)
|
|
if remain=0 then return iff(accu>treat?1:0) end if
|
|
return pick(at-1, remain-1, accu+data[at], treat) +
|
|
iff(at>remain?pick(at-1, remain, accu, treat):0)
|
|
end function
|
|
|
|
int treat = 0, le, gt
|
|
atom total = 1;
|
|
for i=1 to 9 do treat += data[i] end for
|
|
for i=19 to 11 by -1 do total *= i end for
|
|
for i=9 to 1 by -1 do total /= i end for
|
|
|
|
gt = pick(19, 9, 0, treat)
|
|
le = total - gt;
|
|
|
|
printf(1,"<= : %f%% %d\n > : %f%% %d\n",
|
|
{100*le/total, le, 100*gt/total, gt})
|