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

Wrong answer...
Posted by Cross 29 Jan 2011 12:19
program Project1;

{$APPTYPE CONSOLE}
uses
  SysUtils;

var
  N,i,p,y:integer;
  temp:string;

begin
  read(N);
  y:=1;
  for i:= N to 10000000 do
    begin
      temp:=IntToStr(i);
      for p:=1 to length(temp) do
        begin
          y:=y*StrToInt(temp[p]);
          if(y = N)and(i<>0) then
            begin
              writeln(i);
              exit;
            end;
        end;
      y:=1;
    end;
  writeln('-1');
end.

Edited by author 29.01.2011 12:25