Created
November 1, 2019 07:02
-
-
Save kotet/a89c5ca76b188ebf49a6a186aca16eee to your computer and use it in GitHub Desktop.
線形符号
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio : writefln, writef; | |
import std.format : format; | |
import std.conv : to; | |
void main(string[] args) | |
{ | |
long L = args[1].to!long(); | |
auto fmt = format!"%%0%db"(L); | |
outer: foreach (c_bitmask; 1 .. (1 << (1 << L))) | |
{ | |
foreach (ulong x; 0 .. (1 << L)) | |
if (c_bitmask & (1 << x)) | |
foreach (ulong y; x .. (1 << L)) | |
if (c_bitmask & (1 << y)) | |
{ | |
if (!(c_bitmask & (1 << (x ^ y)))) | |
{ | |
continue outer; | |
} | |
} | |
foreach (ulong x; 0 .. (1 << L)) | |
if (c_bitmask & (1 << x)) | |
writef(fmt ~ " ", x); | |
writefln(""); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment