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

I thing the text of 1014 is wrong
Posted by Deian Lambov 18 Nov 2000 18:26
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
Posted by Jivko Ganev 19 Nov 2000 00:32
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
Posted by Deian Lambov 19 Nov 2000 22:59
> 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
Posted by Deian Lambov 19 Nov 2000 23:14

> 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
Posted by Jivko Ganev 20 Nov 2000 01:55
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
Posted by Deian Lambov 20 Nov 2000 14:27
> 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
Posted by Jivko Ganev 20 Nov 2000 14:59
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
Posted by Deian Lambov 20 Nov 2000 16:30
> 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
Posted by Marat Bakirov 21 Nov 2000 12:06
Thanks, man. You are right. That was a misprint.