#include <stdio.h>
#include <stdlib.h>
void convert(int a[], int i);
void inunionver(int a[]);
void uniover(int x, int y, int parent[], int graph[][2]);
int find_root(int x, int parent[]);
int count = 0;
int main() {
int a[7] = {0};
for (int i = 0; i < 128; i++) {
convert(a, i); //将其用二进制数存入数组
}
printf("%d", count);
return 0;
}
void convert(int a[], int i) {
for (int q = 0; q < 7; q++) {
int n = i % 2;
a[6 - q] = n;
i /= 2;
}
inunionver(a);
return;
}
void inunionver(int a[]) {
int parent[7] = {0, 1, 2, 3, 4, 5, 6};
int graph[20][2] = {{0, 5}, {0, 1}, {1, 6}, {1, 2}, {2, 6}, {2, 3}, {3, 4}, {4, 6}, {4, 5}, {5, 6}
, {5, 0}, {1, 0}, {6, 1}, {2, 1}, {6, 2}, {3, 2}, {4, 3}, {6, 4}, {5, 4}, {6, 5}
};
int length = 0;
int arr[7] = {0};
int q = 0;
for (int i = 0; i < 7; i++) {
if (a[i] == 1) {
arr[q] = i;
q++;
length++;
}
}
if (length == 0) {
return;
} else if (length == 1) {
count++;
return;
} else {
for (int f = 0; f < length - 1; f++) {
for (int r = f + 1; r < length; r++) {
uniover(arr[f], arr[r], parent, graph);
}
}
for (int i = 0; i < length; i++) {
int father = find_root(arr[0], parent);
if (find_root(arr[i], parent) != father) {
goto out;
}
}
count++;
}
out:
;
return;
}
void uniover(int x, int y, int parent[], int graph[][2]) {
for (int i = 0; i < 20; i++) {
if (graph[i][0] == x && graph[i][1] == y) {
parent[find_root(y, parent)] = find_root(x, parent);
break;
}
}
return;
}
int find_root(int x, int parent[]) {
int x_root = x;
while (parent[x_root] != x_root) {
x_root = parent[x_root];
}
return x_root;
}