题解

294 条题解

  • 0
    @ 2009-07-13 20:45:02

    编译通过...

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

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

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

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

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

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

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

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

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

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

    跟做梦一样。。数组定义成1..10 交了4次。。。。。

  • 0
    @ 2009-07-13 17:46:27

    我是这样做的,可是怎么也想不通为什么错,更想不通为什么会输出负的

    var

    a:array[-2..17,-2..17] of integer;

    b:array[-2..17,-2..17] of boolean;

    i,x1,x2,y1,y2:integer;

    function f(x,y:integer):integer;

    var

    s:integer;

    begin

    if b[x,y] then f:=a[x,y]

    else begin s:=f(x-1,y)+f(x,y-1); b[x,y]:=true; f:=s; a[x,y]:=s; end;

    end;

    begin

    read(x1,y1,x2,y2);

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

    fillchar(b,sizeof(b),false);

    b[x2,y2]:=true;

    b[x2+1,y2+2]:=true;

    b[x2+1,y2-2]:=true;

    b[x2-1,y2+2]:=true;

    b[x2-1,y2-2]:=true;

    b[x2+2,y2+1]:=true;

    b[x2+2,y2-1]:=true;

    b[x2+2,y2+1]:=true;

    b[x2-2,y2-1]:=true;

    b[x2-2,y2+1]:=true;

    for i:=0 to x1 do begin a:=1; b:=true; end;

    for i:=0 to y1 do begin a[0,i]:=1; b[0,i]:=true; end;

    writeln(f(x1,y1));

    end.

    编译通过...

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

     ├ 错误行输出

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

    ├ 测试数据 03:答案错误...程序输出比正确答案长

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

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

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

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

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

    Unaccepted 有效得分:50 有效耗时:0ms

  • 0
    @ 2009-07-13 16:25:28

    编译通过...

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

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

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

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

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

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

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

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

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

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

    program jj;

    var m,n,i,j,k,x,y:integer;

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

    flag:array[-2..20,-2..20] of boolean;

    begin

    readln(n,m,x,y);

    fillchar(flag,sizeof(flag),true);

    f[0,0]:=1;

    flag[x,y]:=false;

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

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

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

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

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

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

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

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

    for i:=0 to n do

    for j:=0 to m do

    begin

    if flag=false then f:=0

    else

    begin

    if (i=0)and(j0) then f:=f[0,j-1]

    else

    if (j=0)and(i0) then f:=f

    else

    if (j0)and(i0) then f:=f+f;

    end;

    end;

    writeln(f[n,m]);

    end.

    一道老的不能再老的题目…………………………

  • 0
    @ 2009-07-11 13:07:34

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    一次AC!

    用个布尔数组先把马可以吃的地点变F

    然后就是方程 f := f + f;

    很好的dp题

  • 0
    @ 2009-07-10 21:57:51

    编译通过...

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

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

    ├ 测试数据 03:答案错误...程序输出比正确答案长

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

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

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

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

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

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

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

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

    Unaccepted 有效得分:90 有效耗时:0ms

    这是什么情况,晕了

  • 0
    @ 2009-07-03 15:27:31

    一次通过

  • 0
    @ 2009-06-28 09:03:14

    program p1163;

    const a:array[1..8,1..2]of integer=((1,2),(2,1),(2,-1),(1,-2),(-1,-2),(-2,-1),(-2,1),(-1,2));

    var

    b:array[0..15,0..15]of integer;

    sum,k,k2,i1,j1,n,m,n1,m1:longint;

    procedure try(i,j:integer);

    begin

    if ((i+1)

  • 0
    @ 2009-06-25 12:52:03

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    为什么信息奥赛里即有数学奥赛的题,又有物理奥赛的题,现在连象棋里的知识都用上了!!orz!!!!

  • 0
    @ 2009-06-23 19:02:44

    program knight;

    type zhu=array[0..50,0..50] of longint;

    var w1:array[-2..50,-2..50] of boolean;

    w:zhu; n,m,x,y:longint;

    procedure put(a,b:longint);

    begin

    fillchar(w1,sizeof(w1),true);

    w1[a,b]:=false;

    w1[a-2,b+1]:=false;

    w1[a-2,b-1]:=false;

    w1[a-1,b-2]:=false;

    w1[a-1,b+2]:=false;

    w1[a+2,b+1]:=false;

    w1[a+2,b-1]:=false;

    w1[a+1,b-2]:=false;

    w1[a+1,b+2]:=false;

    end;

    procedure knight;

    var i,j:longint;

    begin

    for i:=1 to n do if w1 then w:=1

    else break;

    for i:=1 to m do if w1[0,i] then w[0,i]:=1

    else break;

    for i:=1 to n do

    for j:=1 to m do

    if w1 then w:=w+w;

    writeln(w[n,m]);

    end;

    BEGIN

    readln(n,m,x,y);

    put(x,y);

    knight;

    END.

  • 0
    @ 2009-06-22 20:38:32

    program p1121;

    var

    n,m,p,q,s:integer;

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

    function fac(s,t:integer):integer;

    begin

    if (s=0) and (t=0) then fac:=1

    else if a then fac:=0

    else if s=0 then fac:=fac(s,t-1)

    else if t=0 then fac:=fac(s-1,t)

    else fac:=fac(s,t-1)+fac(s-1,t);

    end;

    begin

    readln(n,m,p,q);

    a[p,q]:=true; a[p-2,q-1]:=true; a[p-1,q-2]:=true;

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

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

    s:=fac(n,m);

    writeln(s);

    readln;

    end.

  • 0
    @ 2009-06-14 15:48:22

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

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

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

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

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

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

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

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

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

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

    老天,去掉个变量就过了

    原来最后两个超是

    AC

  • 0
    @ 2009-06-14 14:20:17

    var

    b:packed array[-1..20,-1..20]of boolean;

    n,m,x,y:integer;

    t:int64;

    procedure find(h:integer;z:integer);

    begin

    if (h=n)and(z=m) then t:=t+1

    else

    begin

    if ((h+1)

  • 0
    @ 2009-06-12 18:12:20

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    program p1121;

    const

    r1:array[1..9] of integer=(2,2,-2,-2,1,1,-1,-1,0);

    r2:array[1..9] of integer=(1,-1,1,-1,2,-2,2,-2,0);

    var

    n,m,i,j,h1,h2:integer;

    ch:boolean;

    a,b:longint;

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

    begin

    read(n,m,h1,h2);

    for i:=0 to n do

    for j:=0 to m do

    way:=-1;

    way[0,0]:=1;

    for i:=1 to 9 do

    way:=0;

    for i:=0 to n do

    for j:=0 to m do

    if way

  • 0
    @ 2009-06-07 17:31:42

    编译通过...

    ├ 测试数据 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-05-29 11:28:53

    const

    dx:array[1..8]of integer=(-2,-2,-1,-1,1,1,2,2);

    dy:array[1..8]of integer=(-1,1,-2,2,-2,2,-1,1);

    var

    {脑子发热,循环变量竟然用int64!}

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

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

    begin

    readln(n,m,x,y);

    {f和f[1,i]不一定都为1,前提是他们前面的点都是1,否则他们永远走不到,应赋值0,我没有想到这一点}

    for i:=0 to n do

    for j:=0 to m do

    f:=1;

    for i:=1 to 8 do

    if (x+dx[i]=0) and (y+dy[i]=0)

    then f[x+dx[i],y+dy[i]]:=0;

    f[x,y]:=0;

    {注意,首行是0而不是1}

    for i:=1 to n do

    if f0 then f:=f;

    for i:=1 to m do

    if f[0,i]0 then f[0,i]:=f[0,i-1];

    for i:=1 to n do

    for j:=1 to m do

    if f0

    then f:=f+f;

    write(f[n,m]);

    end.

  • 0
    @ 2009-05-29 10:48:22

    program tiaoma;

    var

    a:array[0..20,0..20] of int64;

    m,n,i,j:int64;

    x,y:longint;

    begin

    read(n,m,i,j);

    for x:=0 to n do

    for y:=0 to m do

    a[x,y]:=1;

    a:=0;

    a:=0;a:=0;

    a:=0;a:=0;

    a:=0;a:=0;

    a:=0;a:=0;

    for x:=1 to n-1 do

    if a[x,0]=0 then a[x+1,0]:=0;

    for y:=1 to m-1 do

    if a[0,y]=0 then a[0,y+1]:=0;

    x:=1;y:=1;

    while (xm then begin x:=x+1;y:=1;

    end;

    end;

    write(a[n,m]);

    end.

    vijos上的测试数据好弱,这程序我在rqnoj上只得60分。

    谁能告诉我哪错了???

  • 0
    @ 2009-05-28 17:22:18

    关键点:由(0,1)(1,0)坐标和x

  • 0
    @ 2009-05-26 20:27:56

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    为什么提交两次相同的程序用时都不一样 ??

  • 0
    @ 2009-05-24 23:08:51

    var a:array[-2..20,-2..20] of longint;

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

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

    begin

    read(m,n,x,y);

    for i:=0 to m do begin

    for j:=0 to n do

    b:=true; a:=0;

    end; a[0,0]:=1;

    b[x,y]:=false;

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

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

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

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

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

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

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

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

    for i:=1 to m do

    if (a0)and(b) then a:=1;

    for j:=1 to n do

    if (a[0,j-1]0)and(b[0,j]) then a[0,j]:=1;

    for i:=1 to m do begin

    for j:=1 to n do

    if b=true then a:= a+a+a

    end;

    writeln(a[m,n]);

    end.

    思考

  • 0
    @ 2009-05-24 10:42:49

    var a:array[-3..15,-3..15] of integer;

    total,i,j,b1,b2,m1,m2:longint;

    procedure deal(x,y:integer);

    begin

    if (x=b1)and(y=b2) then inc(total)

    else begin

    if (x+1

信息

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