⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ac1109.pas

📁 某牛人写的acm.tongji.edu.cn上大部分ac的代码,仅供学习研究,请不要用来作弊
💻 PAS
字号:
program tju1109;
const
  maxn=100;
var
  cross:array[1..maxn,0..(maxn+1)*maxn shr 1]of boolean;
  count,sum:array[1..maxn]of longint;
  n,i,j,t:word;
begin
  cross[1,0]:=true;
  for n:=2 to maxn do begin
    cross[n,0]:=true;
    for i:=1 to n-1 do begin
      t:=(n-i)*i;
      for j:=0 to (i+1)*i shr 1 do
        if cross[i,j] then cross[n,t+j]:=true;
    end;
  end;

  for n:=1 to maxn do
    for i:=0 to (n+1)*n shr 1 do
      if cross[n,i] then begin
        inc(count[n]);inc(sum[n],i);
      end;

  repeat
    read(n);
    writeln(count[n],' ',sum[n]);
  until seekeof;
end.

⌨️ 快捷键说明

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