#include static unsigned long seed=16807; static char canswer[170]= "300/LP6/AAA 6\ P A6/6/0 6L\ L6 0 A// 0 /\ A06 6 3 60 A\ P6L0/ P/ A0\ L3PA/ P 60/ \ 3 LL/AL A// \ A/36AL3P 6 0\ 6/6//PLP/0 A \ ALP3L/6LAP/A \ 6660303L6/P3\ 6 0/ 3L030A\ A AA0L /L P6"; static char clist[10]=" APL/360 "; static int answer[169]; unsigned long aplrandom() { unsigned long qu7t5=16807; unsigned long qu2t31=2147483647; seed = seed*qu7t5%qu2t31; return seed; } unsigned long frandom(long n) { unsigned long n1; n1 = ((aplrandom()*n)>>31)+1; return n1; } void main() { long i,i1,i2; for(i1=0;i1<169;i1++) { answer[i1]=0; for(i2=0;i2<9;i2++) { if(canswer[i1]==clist[i2]) { answer[i1]=i2+1; break; } } if(i1%13==0) printf("\n"); printf("%d ",answer[i1]); } printf("\n\n"); for(i=0; i<2147483646; i++) { seed=i; for(i2=0;i2<169;i2++) { i1=frandom(9); if(answer[i2]==1) { if(i1!=1 && i1!=9) goto nextseed; } else if(i1!=answer[i2]) { goto nextseed; } } printf("OK: %ld\n",i); nextseed: ; } }