比赛 20100927 评测结果 AAAAAAAAAA
题目名称 细胞分裂 最终得分 100
用户昵称 1102 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2010-09-27 21:17:21
显示代码纯文本
program xxxx;
var  a,b:array[0..30001] of longint;
     n,min,i,max,x:longint;
{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
procedure prework;
var i,m1,m2:longint;
begin fillchar(a,sizeof(a),0);
      readln(m1,m2);
      i:=2;
      while m1<>1 do
      begin while m1 mod i=0 do
            begin inc(a[i]);
                  m1:=m1 div i;
            end;
            inc(i);
      end;
      max:=i;
      for i:=2 to max do
        a[i]:=a[i]*m2;
end;
{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
function work:longint;
var s,max2,i,x,y:longint;
begin fillchar(b,sizeof(b),0);
      max2:=0;
      read(s);i:=2;
      while i<=max do
      begin x:=0;
            while s mod i=0 do
            begin inc(x);
                  s:=s div i;
            end;
            if (a[i]<>0) then
            begin if x=0 then exit(maxlongint);
                  y:=a[i] div x;
                  if a[i] mod x<>0 then inc(y);
                  if y>max2 then max2:=y;
            end;
            inc(i);
      end;
      exit(max2);
end;
{aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa}
begin
assign(input,'cell.in');
reset(input);
assign(output,'cell.out');
rewrite(output);
readln(n);
prework;
min:=maxlongint;
for i:=1 to n do
begin x:=work;
      if x<min then min:=x;
end;
if min=maxlongint then writeln(-1) else writeln(min);
close(input);
close(output);
end.