#include #include //#define N 7 //#define ALLOWED_CHANGES 1 int X[N][N][N][N][N][N][N][N]; long long cnt = 0; inline int test_valid(int a,int b,int c,int d,int e,int f,int g,int h) { int i1,i2,i3,i4,i5,i6,i7,i8,i9; int scenario=0; for(int z=0;z ALLOWED_CHANGES) return 0; } return 1; } inline void display() { cnt++; printf("#%ld: ",cnt); for(int a=0;a 0 ?"+":"-"); } } } } } } } } printf("\n"); } void rec_fill2(int a,int b,int c,int d,int e,int f, int g, int h) { if(a == b) { a = 0; b++; if(b == c) { b = 1; c++; if(c == d) { c = 2; d++; if(d == e) { d = 3; e++; if(e == f) { e = 4; f++; if(f == g) { f = 5; g++; if(g == h) { g = 6; h++; } } } } } } } if(h == N) { display(); } else { for(int v=-1;v<=+1;v+=2) { X[a][b][c][d][e][f][g][h] = v; if(test_valid(a,b,c,d,e,f,g,h)) rec_fill2(a+1,b,c,d,e,f,g,h); X[a][b][c][d][e][f][g][h] = 0; } } } void init_zeros() { for(int a=0;a