比赛 noip-081029 评测结果 AAWTTAATTT
题目名称 最多因子数 最终得分 40
用户昵称 E.M.B.E.R 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-29 20:47:03
显示代码纯文本
program EmberAsh;
const
zs:Array[1..16]of longint=(2,3,5,7,11,13,17,19,23,27,29,31,37,41,43,47);
var
a:array[1..100000]of longint;
i,j,k,max,min,n,m,l,u,p,d,ys,head,ember:longint;

procedure try(o:longint);
label 1;
var
i,j,k:longint;
begin
for i:=1 to 16 do
  begin
  if o mod zs[i]=0 then
    begin
    k:=0;
    while (o mod zs[i]=0) do
      begin
      o:=o div zs[i];
      inc(k);
      end;
    inc(k);
    inc(head);
    a[head]:=k;
    if o=1 then goto 1;
    end;
  end;
1:
max:=1;
for i:=1 to head do
  if a[i]<>0 then
    max:=max*a[i];
ys:=max;
end;

BEGIN
assign(input,'divisors.in');reset(input);
assign(output,'divisors.out');rewrite(output);
readln(l,u);
for i:=l to u do
  begin
  fillchar(a,sizeof(a),0);
  ys:=0;
  head:=0;
  try(i);
  if ys>ember then
    begin
    ember:=ys;
    min:=i;
    end;
  end;
writeln('Between ',l,' and ',u,',',min,' has a maximum of ',ember,' divisors.');
close(input);close(output);
END.