Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
11
Task/Power-set/AutoHotkey/power-set.ahk
Normal file
11
Task/Power-set/AutoHotkey/power-set.ahk
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
a = 1,a,-- ; elements separated by commas
|
||||
StringSplit a, a, `, ; a0 = #elements, a1,a2,... = elements of the set
|
||||
|
||||
t = {
|
||||
Loop % (1<<a0) { ; generate all 0-1 sequences
|
||||
x := A_Index-1
|
||||
Loop % a0
|
||||
t .= (x>>A_Index-1) & 1 ? a%A_Index% "," : ""
|
||||
t .= "}`n{" ; new subsets in new lines
|
||||
}
|
||||
MsgBox % RegExReplace(SubStr(t,1,StrLen(t)-1),",}","}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue