1、Prime CryptarithmThe following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of prime digits 2,3,5,7 is selected, the cryptarithm is called a PRIME CRYPTARITHM. * * *x * *-* * * 0 do beg
2、inif not akk mod 10 then exit;kk:=kk div 10;end;check:=true;end;procedure sub(k1:longint);vari1,m1,m2,m3:longint;beginif k1=6 then beginm1:=a1 mod 10;m2:=a1 mod 100;m3:=a1 div 100;if (m2*m3=1000) and (m2*m3=100)and check(m2*m3) and check(m1*m3) then inc(ans);exit;end;if k1=5 then beginm1:=a1 mod 10;
3、m2:=a1 div 10;if (m1*m2=1000) or (m1*m2100) or not check(m1*m2) then exit;end;for i1:=1 to 9 doif ai1 then begina1:=a1*10+i1;sub(k1+1);a1:=a1 div 10;end;end;beginassign(input,crypt1.in);assign(output,crypt1.out);reset(input);rewrite(output);ans:=0;fillchar(a,sizeof(a),false);readln(n);for i:=1 to n do beginread(m);am:=true;end;a1:=0;sub(1);writeln(ans);close(input);close(output);end.