#include #define MAX_TERMS 10 #define MAX_LEN 10 //#define SHOWALL int noterms,mat[MAX_TERMS+1][MAX_LEN],nolen[MAX_TERMS+1],c[MAX_TERMS+1]; int noch=0,ch[10],dig[10],zeroflag[10]; int solcnt=0,ex[MAX_TERMS+1]; int lookup(char c) { int i; for(i=0;i=0) v+=mul*dig[mat[i][j]]; w[i]=v; tot+=v*((i'9')) zeroflag[lookup(s[0])]=1; for(j=len-1;j>=0;j--,mul*=10) { if ((s[j]>='0') && (s[j]<='9')) c[i]+=mul*(s[j]-'0'); else mat[i][len-1-j]=lookup(s[j]); } } printf("\n"); permute(0,0); if (!solcnt) printf("Olöslig!\n"); else { printf("Det finns %d lösning%s.\n",solcnt,(solcnt>1)?"ar":""); #ifndef SHOWALL show(ex); #endif } return 0; }