Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Power-set/XPL0/power-set.xpl0
Normal file
25
Task/Power-set/XPL0/power-set.xpl0
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
func PowSet(Set, Size);
|
||||
int Set, Size;
|
||||
int N, M, Mask, DoComma;
|
||||
[ChOut(0, ^{);
|
||||
for N:= 0 to 1<<Size -1 do
|
||||
[if N>0 then ChOut(0, ^,);
|
||||
ChOut(0, ^{);
|
||||
Mask:= 1; DoComma:= false;
|
||||
for M:= 0 to Size-1 do
|
||||
[if Mask & N then
|
||||
[if DoComma then ChOut(0, ^,);
|
||||
IntOut(0, Set(M));
|
||||
DoComma:= true;
|
||||
];
|
||||
Mask:= Mask << 1;
|
||||
];
|
||||
ChOut(0, ^});
|
||||
];
|
||||
Text(0, "}^m^j");
|
||||
];
|
||||
|
||||
[PowSet([2, 3, 5, 7], 4);
|
||||
PowSet([1], 1);
|
||||
PowSet(0, 0);
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue