PersonalCorpus 版 (精华区)

148285 11:39:53
28 Feb 2002 Bozhang,HIT,P.R.China 1142 Pascal Accepted 0.01 sec 49K


var
    s:array[1..10,0..9] of integer;
    i,j:integer;
    res:array[2..10] of integer;
begin
    fillchar(s,sizeof(s),0);
    fillchar(res,sizeof(res),0);
    s[1,0]:=1;
    for i:=2 to 10 do
        for j:=0 to i-2 do begin
            s[i,j+1]:=s[i,j+1]+(i-1-j)*s[i-1,j];
            s[i,j]:=s[i,j]+(i-j)*s[i-1,j];
            res[i]:=res[i]+(i+i-j-j-1)*s[i-1,j];
        end;
    readln(i);
    while i<>-1 do begin
        writeln(res[i]);readln(i);
    end;
end.
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.071毫秒