#include #include #define N 7 #define ALLOWED_CHANGES 1 int X[N][N][N]; long cnt = 0; inline int test_valid(int a,int b,int c) { int i,j,k,l; int scenario=0; for(int d=0;d ALLOWED_CHANGES) assert(scenario == 1); // i guess there is an argument for this if(changes > 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) { if(a == b) { a = 0; b++; if(b == c) { b = 1; c++; } } if(c == N) { display(); } else { for(int v=-1;v<=+1;v+=2) { X[a][b][c] = v; if(test_valid(a,b,c)) rec_fill2(a+1,b,c); X[a][b][c] = 0; } } } void rec_fill1(int a,int b,int c) { if(c == N) { b++; c = b+1; if(c == N) { a++; b = a+1; c = b+1; if(c == N) { display(); return; } } } { for(int v=-1;v<=+1;v+=2) { X[a][b][c] = v; if(test_valid(a,b,c)) rec_fill1(a,b,c+1); X[a][b][c] = 0; } } } void init_zeros() { for(int a=0;a