ac1261.pas

来自「这是在网络上搜集到的在东京大学的ACM上面解决的一些题目的源码」· PAS 代码 · 共 18 行

PAS
18
字号
program tju1261;
var
  s,n,t,ans:longint;
begin
  repeat
    read(s);ans:=0;
    for n:=3 to trunc(sqrt(s*2)) do
      if s*2 mod n=0 then begin
        t:=trunc((s/n-1)/((n-1)/2));
        if s mod n=0 then
          if odd(n) then inc(ans,t) else inc(ans,t shr 1)
        else if not odd(n) then
          inc(ans,(t+1) shr 1);
      end;
    writeln(ans);
  until seekeof;
end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?