53 lines
1.2 KiB
C
53 lines
1.2 KiB
C
#include <stdio.h>
|
||
#include <string.h>
|
||
|
||
int main(int argc, char * argv[]) {
|
||
|
||
//~ const char * eq = "КОЗА+КОЗА=СТАДО";
|
||
//~ int len = strlen(eq);
|
||
//~ int i = 0;
|
||
//~ char A='А';
|
||
//~ for(i=0; i<len; i++)
|
||
//~ switch(eq[i]) {
|
||
//~ case '+' : printf("%c", eq[i]); break;
|
||
//~ case '=' : printf("%c", eq[i]); break;
|
||
//~ default: printf("%d", (int)eq[i]-(int)A); break;
|
||
//~ };
|
||
int k, o, z, a, s, t, d;
|
||
int left, right;
|
||
|
||
for(k=1; k<10; k++)
|
||
for(o=0; o<10; o++)
|
||
for(z=0; z<10; z++)
|
||
for(a=0; a<10; a++)
|
||
for(s=1; s<10; s++)
|
||
for(t=0; t<10; t++)
|
||
for(d=0; d<10; d++) {
|
||
left=right=0;
|
||
left*=10; left+=k;
|
||
left*=10; left+=o;
|
||
left*=10; left+=z;
|
||
left*=10; left+=a;
|
||
left *= 2;
|
||
right*=10; right+=s;
|
||
right*=10; right+=t;
|
||
right*=10; right+=a;
|
||
right*=10; right+=d;
|
||
right*=10; right+=o;
|
||
//~ printf("left=%d right=%d", left, right);
|
||
if(k==o || k==z || k==a || k==s || k==t || k==d ||
|
||
o==z || o==a || o==s || o==t || o==d ||
|
||
z==a || z==s || z==t || z==d ||
|
||
a==s || a==t || a==d ||
|
||
s==t || s==d ||
|
||
t==d)
|
||
continue;
|
||
if(left == right) {
|
||
printf("%d%d%d%d+%d%d%d%d=%d%d%d%d%d\n",k,o,z,a,k,o,z,a,s,t,a,d,o);
|
||
}
|
||
}
|
||
|
||
|
||
return 0;
|
||
}
|