014
02.06.2003, 19:30 Uhr
~0xdeadbeef
Gast
|
...und der hier schmeißt prompt ne Lösung raus. Manchmal hab ich echt ein Brett vorm Kopf...
C++: |
static const int primes[]={11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97};
main() { int A, B, C, D, E, F, G, H, a, b, c, d, e, f, g, h, ai,bi,ci,di,ei,fi,gi,hi;
for(ai = 0; ai < 21; ++ai) { A = primes[ai]/10; a = primes[ai]%10; for(bi = 0; bi < 5; ++bi) { B = primes[bi]/10; b = primes[bi]%10; for(ci = 0; ci < 21; ++ci) { C = primes[ci]/10; c = primes[ci]%10; if((A * 100 + B * 10 + C)%(A * 10 + a)==0 && a == c) for(di = 0; di < 21; ++di) { D = primes[di]/10; d = primes[di]%10; for(ei = 0; ei < 21; ++ei) { E = primes[ei]/10; e = primes[ei]%10; if(C * 100 + D * 10 + E == (C * 10 + c) * (C + D + E) && B * 10 + b == c + d + e) for(fi = 0; fi < 21; ++fi) { F = primes[fi]/10; f = primes[fi]%10; for(gi = 0; gi < 21; ++gi) { G = primes[gi]/10; g = primes[gi]%10; if((E * 100 + F * 10 + G) % (A * 10 + a) == 0 && e * 100 + f * 10 + g == (A * 10 + a) * (e + f + g)) for(hi = 0; hi < 21; ++hi) { H = primes[hi]/10; h = primes[hi]%10; if((G * 100 + H * 10 + A) == (e * 10 + E) * (A + B + C) && g + h + a == C * 10 + c){ printf("A=%d, B=%d, C=%d, D=%d, E=%d, F=%d, G=%d H=%d, a=%d, b=%d, c=%d, d=%d, f=%d, g=%d, h=%d\n", A,B,C,D,E,F,G,H,a,b,c,d,e,f,g,h); } } } } } } } } } return 0; }
|
Die Lösung ist: A=7, B=1, C=1, D=3, E=3, F=1, G=6 H=5, a=9, b=7, c=9, d=1, f=7, g=1, h=1 |