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

Discussion of Problem 1118. Nontrivial Numbers

help me pleas??? i can not get AC!!
Posted by I am david. Tabo. 19 Apr 2002 00:41
type
  c=record
    d:longint;
    h:real;
end;

var sol,gam,i,j,k,l,m,n,b:longint;
    a:array [1..10000] of c;
    min:real;

procedure readdata;
  begin
    readln (n,m);
  end;

procedure check;
  begin
    if n=1 then
      begin
        writeln (0);
        halt;
      end;
  end;

procedure solve;
  begin
    for i:=n to m do
      begin
        k:=i div 2;
        for j:=1 to k do
          if i mod j = 0 then
            gam:=gam+j;
        inc (b);
        a[b].d:=i;
        a[b].h:=gam/i;
        gam:=0;
        if i>=m then
          break;
      end;
    min:=a[1].h;
    for i:=1 to b do
      if min>a[i].h then
        begin
          min:=a[i].h;
          sol:=a[i].d;
        end;
  end;

procedure print;
  begin
    writeln (sol);
  end;

begin
  readdata;
  check;
  solve;
  print;
end.