COUNTCBG - COUNT N

Tác giả: RR

Ngôn ngữ: Pascal

var
  res,tong,hieu,n,i,gh:longint;
begin
  while not eof do
    begin
      readln(n); n:=n shl 1;
      gh:=trunc(sqrt(n));
      res:=0;
      for i:=2 to gh do
        if n mod i=0 then
          begin
            if i*i=n then continue;

            tong:=i; hieu:=n div i-1;
            if (tong+hieu) and 1=0 then inc(res);
          end;
      writeln(res);
    end;
end.

Download