NKABD - Số phong phú

Tác giả: ladpro98

Ngôn ngữ: Pascal

program nkab;
var     l,r,i,res,j:longint;
        s:array[1..100000] of longint;
begin
        readln(l,r);
        for i:=1 to r do
        begin
                j:=2;
                while (i*j<=r) do
                begin
                        inc(s[i*j],i);
                        inc(j);
                end;
        end;
        for i:=l to r do
        if s[i]>i then inc(res);
        write(res);
end.

Download