I thing the text of 1014 is wrong
It is written that N<=10**6 and i found that there is much
bigger N (N>10**9) in the test cases! With such N the
answer is bigger than MaxLongint!
Re: I thing the text of 1014 is wrong..NO
var n : longint;
A : array [2..9] of byte;
i : byte;
begin
readln(n);
fillchar(A, sizeof(A), 0);
if n = 0 then begin write(10); halt; end;
if n = 1 then begin write(1); halt; end;
for i := 9 downto 2 do
while n mod i = 0 do
begin
inc(A[i]);
n := n div i;
end;
if n <> 1 then write(-1) else
begin
for i := 2 to 9 do
while A[i] <> 0 do
begin
dec(A[i]);
write(i);
end;
end;
end.
This got accept no comment.
Re: I thing the text of 1014 is wrong..NO
> var n : longint;
> A : array [2..9] of byte;
> i : byte;
>
> begin
> readln(n);
> fillchar(A, sizeof(A), 0);
> if n = 0 then begin write(10); halt; end;
> if n = 1 then begin write(1); halt; end;
> for i := 9 downto 2 do
> while n mod i = 0 do
> begin
> inc(A[i]);
> n := n div i;
> end;
> if n <> 1 then write(-1) else
> begin
> for i := 2 to 9 do
> while A[i] <> 0 do
> begin
> dec(A[i]);
> write(i);
> end;
> end;
> end.
>
> This got accept no comment.
Re: I thing the text of 1014 is wrong..NO
> This got accept no comment.
I've got accept with my own program, before I've posted
this message!
But I kept getting WA for a long time, because I thought
N<10**6(i didn't store the result in array )! Finaly I
found that N>10**6! And I wrote this message because the
text of 1014 must be changed!
Re: I thing the text of 1014 is wrong..NO
Ok man.Drink a cold glass of water then go read the
text.There is no single spot in the problem text where it
says that the output number Q has to be <= 10**6.
Re: I thing the text of 1014 is wrong..NO
> Ok man.Drink a cold glass of water then go read the
> text.There is no single spot in the problem text where it
> says that the output number Q has to be <= 10**6.
But if N<=10**6 then Q is not bigger than LongInt!
Re: I thing the text of 1014 is wrong..NO
I have to agree on that.I added the line if n > 1000000
then halt; and my program stopped working.
Re: I thing the text of 1014 is wrong..NO
> I have to agree on that.I added the line if n > 1000000
> then halt; and my program stopped working.
I did the same:)
As far as I remember n<=10**9(instead of n<=10**6)!
fixed
Thanks, man. You are right. That was a misprint.