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 CE !!!!!!!!!!!!!!!!!!!!!!!!!!! Help Please!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Aex_TKTL 12 Mar 2007 20:33
I compile my solution on my computer and it passes all my tests. But there it can't be compiled I usually get CE
Here is my solution

var a:array[1..1000]of integer;
    n,i,j:longint;
begin read(n);
      if (n=1) then begin write(1); halt(0); end;
      if (n=0) then begin write(10); halt(0); end;
      while n<>1 do
      begin
           for i:=9 downto 1 do
               if n mod i=0 then
                  begin inc(j);
                        a[j]:=i;
                        n:=n div i;
                        i:=9;
                  end;
           if n>1 then
              begin
                    write(-1);
                    halt(0);
              end;
      end;
      for i:=j downto 1 do write(a[i]);
end.

Edited by author 12.03.2007 22:25
Re: Why CE !!!!!!!!!!!!!!!!!!!!!!!!!!! Help Please!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by TECTOBOP 13 Mar 2007 02:30
if n mod i=0 then
begin inc(j);
a[j]:=i;
n:=n div i;
i:=9;
end;

Just deleted bolded line and got WA.

Edited by author 13.03.2007 02:31
Re: Why CE !!!!!!!!!!!!!!!!!!!!!!!!!!! Help Please!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Logic 13 Mar 2007 10:23


Edited by author 14.03.2007 14:44
Re: Why CE !!!!!!!!!!!!!!!!!!!!!!!!!!! Help Please!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Shady TKTL 13 Mar 2007 22:00
Logic wrote 13 March 2007 10:23
stupid

If you stupid dont think that all are stopid too!!!

And study geometry!!!

Edited by author 13.03.2007 22:03
Re: Why CE !!!!!!!!!!!!!!!!!!!!!!!!!!! Help Please!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by Alias (Alexander Prudaev) 14 Mar 2007 10:33
replace "for i:= 9 downto 1 do begin ... end"
with
i:= 9; while (i>=1) do
begin
...
i = i - 1;
end;
Re: Why CE !!!!!!!!!!!!!!!!!!!!!!!!!!! Help Please!!!!!!!!!!!!!!!!!!!!!!!!!!!
Posted by GENIUM 14 Mar 2007 14:44
Just Sorry GENIUM
Posted by Shady TKTL 14 Mar 2007 18:22