September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -1,28 +0,0 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
static void powerset(int argc, char** argv)
{
unsigned int i, j, bits, i_max = 1U << argc;
if (argc >= sizeof(i) * CHAR_BIT) {
fprintf(stderr, "Error: set too large\n");
exit(1);
}
for (i = 0; i < i_max ; ++i) {
printf("{");
for (bits = i, j = 0; bits; bits >>= 1, ++j) {
if (bits & 1)
printf(bits > 1 ? "%s, " : "%s", argv[j]);
}
printf("}\n");
}
}
int main(int argc, char* argv[])
{
powerset(argc - 1, argv + 1);
return 0;
}

View file

@ -1,17 +0,0 @@
% ./a.out 1 2 3 4
{}
{1}
{2}
{1, 2}
{3}
{1, 3}
{2, 3}
{1, 2, 3}
{4}
{1, 4}
{2, 4}
{1, 2, 4}
{3, 4}
{1, 3, 4}
{2, 3, 4}
{1, 2, 3, 4}