ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1014. Product of Digits

test 3 dan qaytvotti xatosi qatta?
Posted by Chornovek 20 Nov 2012 14:46
   var
a:array[1..10000] of Longint;
b:array[1..10000] of string;
min,c,n,i,j,k:Longint;
s:string;
begin
read(n);
for i:=2 to n-1 do
begin
 if n mod i=0 then j:=i;
 if (j<>0) and (j<10)  then
 begin
 k:=k+1;
 str(j,b[k]);  str(trunc(n div j),s);
 b[k]:=b[k]+s
 end;
end;
 for i:=1 to k do val(b[i],a[i],c);
 min:=a[1];
 for i:=1 to k do
  if min>a[i] then min:=a[i];
  if min<>0 then write(min);
 if j=0 then  write('-1');
 end.