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

Common Board

1014 Pascal WA 3?
Posted by Dior 13 May 2014 06:59
uses crt;
var
s:string;
a,k:longint;

begin
read(a);
        k:=9;
        repeat
        if a mod k=0 then
         begin
         s:=chr(k+48)+s;
         a:=a div k;
         end
        else
        k:=k-1;
        until k=1;
        if a=1 then
         begin
         write(s);
         end
        else write('-1');

end.

Edited by author 13.05.2014 06:59

Edited by author 13.05.2014 07:22

Edited by author 13.05.2014 07:23