This is David Ashley's page for
solution(s) to Google's 2006 puzzle sampler.
Balancing act:
8 3 4 10 7 5 1 2 6 9
#define LOOP(x) for(n[x]=1;n[x]<=10;++n[x]) {int t;for(t=1;t<x;++t) if(n[t]==n[x]) break;if(t<x) continue;
#define a n[1]
#define b n[2]
#define c n[3]
#define d n[4]
#define e n[5]
#define f n[6]
#define g n[7]
#define h n[8]
#define i n[9]
#define j n[10]
main()
{
int n[11];
LOOP(1)
LOOP(2)
LOOP(3)
LOOP(4)
LOOP(5)
LOOP(6)
LOOP(7)
LOOP(8)
LOOP(9)
LOOP(10)
if(a+e+e+f+f+g+g != b+c+d+h+i+j) continue;
if(e != f+g+g) continue;
if(b+b+c != d) continue;
if(h+h+h+i+i != j+j) continue;
if(b+c+d != h+i+j) continue;
printf("%2d %2d %2d %2d %2d %2d %2d %2d %2d %2d\n", a,b,c,d,e,f,g,h,i,j);
}
}
}
}
}
}
}
}
}
}
}
Accessed 1918 times since 20060809.