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

Why WA!!! Please Help!! Program included!
Posted by Grebnov Ilya[ISPU] 1 Oct 2002 10:30
CONST
  max = 50;
VAR
  Dig : ARRAY[1..max] OF Byte;
  N : LongInt;
  FUNCTION Solve(N : LongInt) : String;
  VAR
    L, I : Byte;
    Res : String;
  BEGIN
    L := 0;
    FOR I := 9 DOWNTO 2 DO
      BEGIN
        WHILE (N MOD I = 0) DO
          BEGIN
            N := N DIV I;
            Inc(L);
            Dig[L] := I;
          END;
      END;
    IF N <> 1 THEN Solve := '-1'
    ELSE
      BEGIN
        Res := '';
        FOR I := L DOWNTO 1 DO
          Res := Res+Chr(Dig[I]+$30);
        Solve := Res;
      END;
  END;
BEGIN
  Read(N);
  IF N < 0 THEN Write('-1')
  ELSE
    IF N = 0 THEN Write('10')
  ELSE
    Write(Solve(N));
END.
Doesn't matter! I've solve it!
Posted by Grebnov Ilya[ISPU] 3 Oct 2002 01:05
Re: send me the solution
Posted by ratrax21 14 Mar 2003 13:23
>
>