题解

294 条题解

  • 0
    @ 2008-12-31 15:19:31

    加法原理……

  • 0
    @ 2008-12-28 11:53:00

    我把一个y写成x,WA了。。。

  • 0
    @ 2008-12-13 20:09:13

    用记忆化搜索,用不着去拓扑了

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    const p:array[1..4] of longint=(-2,-1,1,2);

    var i,j,n,m,a,b,c,d:integer;

    w:longint;

    f:array[0..15,0..15] of longint;

    function find(x,y:integer):longint;

    var e,g,t,s:longint;

    begin

    e:=x-1;g:=y-1;t:=0;s:=0;

    if (e>=0) then begin if f[e,y]=0 then f[e,y]:=find(e,y);

    if f[e,y]=-1 then t:=0 else t:=f[e,y];end;

    if (g>=0) then begin if f[x,g]=0 then f[x,g]:=find(x,g);

    if f[x,g]=-1 then s:=0 else s:=f[x,g];end;

    t:=t+s;if t=0 then find:=-1 else find:=t;

    end;

    begin

    readln(n,m,a,b);

    f[0,0]:=1;f[a,b]:=-1;

    for i:=1 to 4 do

    for j:=1 to 4 do

    if abs(p[i])abs(p[j]) then

    begin

    c:=a+p[i];d:=b+p[j];

    if (c>=0)and(c=0)and(d

  • 0
    @ 2008-12-07 14:49:32

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    var

    n,m,i,j,k,nn,mm:longint;

    tot:qword;

    a:array[-3..20,-3..20] of boolean;

    procedure bad;

    var

    i,j,k:longint;

    begin

    a[nn-2,mm-1]:=false; a[nn-2,mm+1]:=false;

    a[nn+2,mm-1]:=false; a[nn+2,mm+1]:=false;

    a[nn-1,mm-2]:=false; a[nn-1,mm+2]:=false;

    a[nn+1,mm-2]:=false; a[nn+1,mm+2]:=false;

    a[nn,mm]:=false;

    end;

    procedure find(x,y:longint);

    var

    i,j,k:longint;

    begin

    if (x=n)and(y=m) then begin

    inc(tot);

    end else begin

    if (a[x+1,y]=true) then begin

    a[x,y]:=false;

    find(x+1,y);

    a[x,y]:=true;

    end;

    if (a[x,y+1]=true) then begin

    a[x,y]:=false;

    find(x,y+1);

    a[x,y]:=true;

    end;

    end;

    end;

    begin

    fillchar(a,sizeof(a),false);

    tot:=0;

    readln(n,m,nn,mm);

    for i:=0 to n do

    for j:=0 to m do

    a:=true;

    bad;

    find(0,0);

    write(tot);

    end.

    ╭︿︿︿╮

    {/ ︿︿ /}

    ( (oo) )

    ︶ ︶ ︶

    O(∩_∩)O哈哈~

    一次AC

  • 0
    @ 2008-12-06 16:48:30

    原来又for循环会增加时间复杂度~~~~~~~~

  • 0
    @ 2008-12-05 22:30:25

    大家……居然用搜索……我囧了。。。。

    所以我也决定,PiaDP拜搜索...

    10分钟后。。

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

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

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

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

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

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

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

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

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

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

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

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

    膜拜搜索是要付出代价的。。

    var a:array[-2..18,-2..18] of boolean;t:qword;n,m,i,j:integer;

    procedure go(i,j:integer); {搜索路径的递归}

    begin

    if a then exit; {走到了不该走的地方...(会吃掉马或者被马吃掉)}

    if (i=n) and (j=m) then inc(t) else {如果到目的地了,方法数就+1}

    begin

    if (i+1)

  • 0
    @ 2008-11-13 23:57:27

    #include

    long int number=0;

    int a[1000][1000]={0};

    int n,m,b,c;

    int path(int x,int y)

    { if( a[x][y]!=1 &&x

  • 0
    @ 2008-11-13 20:57:11

    program horse;

    var

    f:array[-2..17,-2..17] of 0..1;

    i,j,m,n,a,b:byte;

    s:longint;

    procedure try(x,y:byte);

    begin

    if (x=m) and (y=n) then begin inc(s); end;

    if (x

  • 0
    @ 2008-11-12 20:53:15

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

  • 0
    @ 2008-11-12 18:41:52

    program gjz;

    var

    x,y,i,j,m,n:longint;

    a:array[-2..100,-2..100] of boolean;

    f:array[-2..100,-2..100]of int64;

    begin

    read(n,m);

    read(x,y);

    f[0,0]:=1;

    for i:=-2 to n+2 do

    for j:=-2 to m+2 do

    a:=false;

    for i:=0 to n do

    for j:=0 to m do

    a:=true;

    a[x,y]:=false;

    a[x-2,y-1]:=false;

    a[x-2,y+1]:=false;

    a[x-1,y+2]:=false;

    a[x-1,y-2]:=false;

    a[x+1,y-2]:=false;

    a[x+2,y-1]:=false;

    a[x+2,y+1]:=false;

    a[x+1,y+2]:=false;

    for i:=0 to n do

    for j:=0 to m do

    begin

    if (a) and (a) then f:=f+f;

    if (a) and (a) then f:=f+f;

    end;

    writeln(f[n,m]);

    end.

  • 0
    @ 2008-11-11 21:44:02

    1.递推

    2.注意初始化

    3.杨辉三角——组合数

    4.搜索

    可以说,这个题考查范围还是很多的,当然,一般是用到了上面的某些部分就可以AC了

  • 0
    @ 2008-11-11 20:03:43

    ... = = 該死的longint

  • 0
    @ 2008-11-09 18:32:51

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    燕麦

    你说是典型的连续递归+最短路线

    为什么你用递推啊。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

  • 0
    @ 2008-11-09 10:23:10

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

  • 0
    @ 2008-11-08 15:29:13

    跟 送给圣诞夜的极光 没什么两样 而且还要简单 典型的连续递归+最短路线 水啊~

    var;{竟然要用int64,我可怜的通过率只有50%啦}

    n,m,p,q:int64;

    i,j:longint;

    a:array[-3..20,-3..20] of int64

    b:array[-3..20,-3..20] of 0..2;

    begin

    readln(n,m,p,q);

    fillchar(b,sizeof(b),0);

    fillchar(a,sizeof(a),0);

    a[0,0]:=1;

    b[0,0]:=1;

    b[p,q]:=1;

    b[p-2,q-1]:=1;

    b[p-2,q+1]:=1;

    b[p-1,q-2]:=1;

    b[p-1,q+2]:=1;

    b[p+1,q+2]:=1;

    b[p+1,q-2]:=1;

    b[p+2,q+1]:=1;

    b[p+2,q-1]:=1;

    for i := 0 to n do

    for j := 0 to m do

    if b=0 then a:=a+a;

    write(a[n,m]);

    readln;

    end.

  • 0
    @ 2008-11-07 09:31:47

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    ......

  • 0
    @ 2008-11-04 16:37:06

    AC第一百题...纪念一下~~

  • 0
    @ 2008-11-03 23:20:12

    卒行走的规则:可以向下、或者向右.....这啥意思啊??向下不是减了么??题有问题!!

  • 0
    @ 2008-11-03 21:39:07

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    我学C++,两次交成pascal,竟不知错哪,还在那儿找错!!!

    #include

    using namespace std;

    main ()

    {

    int x1[9]={0,-1,-2,-2,-1,1,2,2,1};

    int y1[9]={0,-2,-1,1,2,2,1,-1,-2};

    int bx,by,hx,hy,q,w;

    cin>>bx>>by>>hx>>hy;

    int a[bx+1][by+1];

    for (int i=0;i

  • 0
    @ 2008-11-03 15:39:20

    //By Vinci Haber

    var

    n,m,ha,hb:longint;

    i:int64;

    allow:array[-2..17,-2..17] of 0..2;

    procedure Go(hen,lie:longint);

    begin

    if allow[hen,lie]=1 then exit;

    if allow[hen,lie]=2 then begin inc(i);exit; end;

    if hen+1

信息

ID
1121
难度
4
分类
动态规划 点击显示
标签
递交数
9572
已通过
3779
通过率
39%
被复制
23
上传者