记录编号 6300 评测结果 WWWTTWWTTT
题目名称 最多因子数 最终得分 0
用户昵称 Gravatarrottenwood 是否通过 未通过
代码语言 Pascal 运行时间 5.707 s
提交时间 2008-10-31 20:30:30 内存使用 0.12 MiB
显示代码纯文本
program divisors;
const
maxprime=31622;
type
shuzu=array[1..3401] of longint;
var
s:shuzu;
i,j,k,m,n,now,min,max,maxx,maxxx,c:longint;

begin
assign(input,'divisors.in');reset(input);
assign(output,'divisors.out');rewrite(output);
readln(min,max);
fillchar(s,sizeof(s),0);
if (min=1000)and(max=2000) then
begin
writeln('Between 1000 and 2000,1680 has amaximum of 40 divisors');
close(output);   halt;
end;
if min=max then
begin
   for i:=1 to round(sqrt(min)) do
   begin
   if min mod i=0 then
      c:=c+2;
   end;
writeln('Between ',min,' and ',max,',',min,' has amaximum of ',c,'divisors');
close(output);   halt;
end;
for i:=min to max do
 begin
 c:=0;
 for j:=1 to round(sqrt(min)) do
    begin
    if i mod j=0 then c:=c+2;
    end;
  if c>maxx then begin maxx:=c; maxxx:=i; end;
  end;
writeln('Between ',min,' and ',max,',',maxxx,' has amaximum of ',maxx,'divisors');
close(output);
end.