36 条题解

  • 2
    @ 2015-10-16 22:15:00

    program sdadsaf;

    var i,j,k,l,m,n,lena,lenb,x,lenc,y:longint;
    a,c,d:array[0..100000] of longint;
    b:array[0..100,0..100,0..900] of longint;
    e:array[0..100,0..100] of longint;
    s,s1:ansistring;
    begin
    b[100,0,1]:=1;
    e[100,0]:=1;
    for i:=1 to 100 do
    begin
    b[i,1,1]:=1;
    e[i,1]:=1;
    b[i,i,1]:=1;
    e[i,i]:=1;
    end;
    for i:=2 to 100 do
    for j:=2 to i-1 do
    begin
    fillchar(c,sizeof(c),0);
    fillchar(d,sizeof(d),0);
    fillchar(a,sizeof(a),0);
    lena:=e[i-1,j];
    x:=0;
    for k:=1 to lena do
    begin
    x:=x+b[i-1,j,k]*j;
    a[k]:=x mod 10000;
    x:=x div 10000;
    end;
    while x>0 do
    begin
    inc(lena);
    a[lena]:=x mod 10000;
    x:=x div 10000;
    end;
    lenc:=e[i-1,j-1];
    y:=1;
    while (y<=lena) or(y<=lenc) do
    begin
    d[y]:=a[y]+b[i-1,j-1,y]+x;
    x:=d[y] div 10000;
    d[y]:=d[y] mod 10000;
    inc(y);
    end;
    if x>0 then
    begin
    lenb:=y;
    d[y]:=x;
    end
    else
    lenb:=y-1;
    for k:=lenb downto 1 do
    b[i,j,k]:=d[k];
    e[i,j]:=lenb;
    end;

    while not(eof) do
    begin
    readln(n,m);
    if m>n then
    writeln(0)
    else
    begin
    write(b[n,m,e[n,m]]);
    for i:=e[n,m]-1 downto 1 do
    begin
    if b[n,m,i]<1000 then
    write(0);
    if b[n,m,i]<100 then
    write(0);
    if b[n,m,i]<10 then
    write(0);
    write(b[n,m,i]);
    end;
    writeln;
    end;

    end;
    end.

  • 0
    @ 2009-11-05 21:22:07

    注意N

  • 0
    @ 2009-11-01 15:19:11

    不用压万进制,直接高精度就可以了

  • 0
    @ 2009-10-29 08:02:31

    f表示i只鳖,从j只瓮中捉出的方案数

    f=f*j+f

    第一种情况是先从j只瓮中捉出i-1只鳖,第i只鳖可以从1~j这j只瓮中捉出,且每种都是单独的方案,所以这种情况要加j次。

    第二种情况是先从j-1只瓮中捉出i-1只鳖,最后一只鳖从单独的一只瓮中捉出,由于不考虑瓮的顺序,这种情况只能加一次。

    接下来就是高精了。我用万进制,全部秒杀。

  • 0
    @ 2009-09-28 08:53:43

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2009-09-26 08:00:42

    高精度 压十四位

    const m=100000000000000;

    type

    arr=array[0..100] of int64;

    var

    i,j,x,y:longint;

    f:array[0..100,0..100] of arr;

    s:string;

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    procedure cheng(var a:arr;b:arr;k:longint);

    var

    i,j:longint;

    begin

    a:=b;

    for i:=1 to a[0] do a[i]:=a[i]*k;

    for i:=1 to a[0]+4 do

    if a[i]>m then

    begin

    a:=a+a[i]div m;

    a[i]:=a[i]mod m;

    end;

    while a[a[0]]0 do inc(a[0]);

    end;

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    procedure add(var a:arr;b:arr);

    var

    i,k:longint;

    begin

    if a[0]m then

    begin

    a:=a+a[i]div m;

    a[i]:=a[i] mod m;

    end;

    while a[a[0]]0 do inc(a[0]);

    end;

    //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    procedure out(a:arr);

    var

    i:longint;

    begin

    while (a[a[0]]=0)and(a[0]>1) do dec(a[0]);

    write(a[a[0]]);

    for i:=a[0]-1 downto 1 do

    begin

    if a[i]

  • 0
    @ 2009-09-15 22:59:57

    高精版 盒子与球,而且盒子是没区别的,就高精加法就好了。

    (n

  • 0
    @ 2009-09-12 09:40:35

    裸Stirling为什么不能AC……

  • 0
    @ 2009-09-03 17:46:22

    第二类斯特林数...............

  • 0
    @ 2009-08-18 21:59:37

    考试时用了递归形式的递推...6个202...改成先求出所有解..ms..郁闷

  • 0
    @ 2009-08-14 21:32:36

    测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    怎么回事呢………………找不出来了

  • 0
    @ 2009-08-14 18:56:46

    没看可有多个n,m

    还说格式错误

    改了半天

    不知错哪了

    才ac

    太晕了!

  • 0
    @ 2009-08-13 21:01:37

    记得n=0或m=0的情况

  • 0
    @ 2009-08-11 21:15:17

    for i := 1 to n do

    for j := 1 to r do

    s[i][j]:=s[j-1]+j * s[j];

  • 0
    @ 2009-08-11 18:29:00

    type

    stype=array[0..2000] of longint;

    var

    n,m:integer;

    j1,j2:longint;

    la,lb:longint;

    f:array[0..100,0..100] of stype;

    function add(a:stype; b:stype):stype;

    var x:longint; i:longint;

    begin

    x:=0;

    if a[0]

    0 then begin add[0]:=add[0]+1; add[a[0]]:=x; end;

    end;

    function cheng(var a:stype;c:longint):stype;

    var

    i:longint;

    begin

    a[1]:=a[1]*c;

    for i:=2 to a[0] do

    begin

    a[i]:=a[i]*c;

    a[i]:=a[i]+a div 10;

    a:=a mod 10;

    end;

    while a[a[0]]>=10 do

    begin

    inc(a[0]);

    a[a[0]]:=a[a[0]-1] div 10;

    a[a[0]-1]:=a[a[0]-1] mod 10;

    end;

    exit(a);

    end;

    begin

    f[0,0][1]:=0; f[0,0][0]:=1;

    for j1:=1 to 100 do

    begin

    f[j1,1][1]:=1; f[j1,1][0]:=1;

    f[j1,j1][1]:=1;f[j1,j1][0]:=1;

    end;

    for j1:=1 to 100 do

    for j2:=2 to j1-1 do

    f[j1,j2]:=add(cheng(f[j1-1,j2],j2),f[j1-1,j2-1]);

    while not eof do

    begin

    readln(n,m);

    for j1:=f[n,m][0] downto 1 do write(f[n,m][j1]);

    end;

    end.

    帮忙看看,问题出在哪儿?谢谢~

  • 0
    @ 2009-08-11 13:21:58

    const

    wei=10000;

    type

    arr=array[0..100] of longint;

    var

    f:array[0..100,0..100] of arr;

    i,j,n,m:longint;

    function chen(a:arr;b:longint):arr;

    var

    i:longint;

    begin

    for i:=1 to a[0] do

    a[i]:=a[i]*b;

    for i:=1 to a[0] do

    begin

    a:=a+a[i] div wei;

    a[i]:=a[i] mod wei;

    end;

    if a[a[0]+1]>0 then inc(a[0]);

    exit(a);

    end;

    function jia(a,b:arr):arr;

    var

    i:longint;

    c:arr;

    begin

    if a[0]0 then inc(a[0]);

    exit(a);

    end;

    procedure outputit(a:arr);

    var

    i:longint;

    begin

    write(a[a[0]]);

    for i:=a[0]-1 downto 1 do

    begin

    if a[i]

  • 0
    @ 2009-08-11 09:57:19

    自信的我没用小号,准备一次AC~惨痛的50分,窘啊~早知道先看题解

    同楼下

  • 0
    @ 2009-08-10 10:48:25

    高精度不能懒啊!

  • 0
    @ 2009-08-10 10:29:32

    如对本题有疑问可以参看我的题解(内附代码):http://xujieqi.blog.hexun.com/36038458_d.html

  • 0
    @ 2009-08-10 07:51:29

    n=0...

    笨笨不想做生意了...

信息

ID
1588
难度
7
分类
组合数学 | 高精度 点击显示
标签
递交数
1976
已通过
399
通过率
20%
被复制
2
上传者