Skip to content

Instantly share code, notes, and snippets.

@kotet
Created November 1, 2019 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kotet/a89c5ca76b188ebf49a6a186aca16eee to your computer and use it in GitHub Desktop.
Save kotet/a89c5ca76b188ebf49a6a186aca16eee to your computer and use it in GitHub Desktop.
線形符号
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