帮帮我吧!!!!!!!!!!!

怎麽会超时??????????????????

帮我看看>>>>>>>>>>>>>>

^_^

^_^

^_^

^_^

我是'菜鸟'低能错误请不要见怪.

2 条评论

  • @ 2009-04-24 18:15:42

    program alpha(input,output);

    const maxn=26;

    type arr=array[1..maxn]of -1..maxn-1;

    arrc=array[1..maxn]of char;

    var a,b,c:string;

    haschar:array['A'..'Z']of boolean;

    n,i,j,k:integer;

    p,q,r:arr;

    v:array['A'..'Z']of 0..maxn-1;

    work:arrc;

    used:array[0..maxn-1]of boolean;

    procedure out_put;

    var i:integer;

    begin

    for i:=1 to n-1 do

    write(v[chr(ord('A')+i-1)],' ');

    writeln(v[chr(ord('A')+n-1)]);

    halt;

    end;

    function ok:boolean;

    var i,c:integer;flag:boolean;

    begin

    flag:=true;i:=n;c:=0;

    while flag and (i>=1) do

    if (p[i]=-1) or (q[i]=-1) or (r[i]=-1) then break

    else

    if (c+p[i]+q[i]) mod nr[i] then flag:=false

    else begin

    c:=(c+p[i]+q[i]) div n;

    i:=i-1;

    end;

    if (i=0 ) and (c0) then flag:=false;

    ok:=flag;

    end;

    function check:boolean;

    var i,v1,v2:integer;flag:boolean;

    begin

    flag:=true;i:=n;

    while flag and (i>=1) do begin

    if (p[i]-1) and (q[i]-1) and (r[i]-1) then

    if ((p[i]+q[i]) mod nr[i]) and ((p[i]+q[i]+1) mod nr[i]) then

    flag:=false

    else if (p[i]-1) and (q[i]-1) and (r[i]=-1) then begin

    v1:=(p[i]+q[i]) mod n;

    if used[v1] and used[(v1+1) mod n] then flag:=false;end

    else if (p[i]-1) and (q[i]=-1) and (r[i]-1) then begin

    v1:=(r[i]-p[i]+n) mod n;

    if used[v1] and used[(v1+n-1) mod n] then flag:=false;end

    else if (p[i]=-1) and (q[i]-1) and (r[i]-1) then begin

    v1:=(r[i]-q[i]+n) mod n;

    if used[v1] and used[(v1+n-1) mod n] then flag:=false;end;

    i:=i-1;

    end;

    check:=flag;

    end;

    procedure change(var p:arr;a:arrc;c:char;v:integer);

    var i:integer;

    begin

    for i:=1 to n do

    if a[i]=c then p[i]:=v;

    end;

    procedure try(i:integer);

    var j,k:integer;

    p1,q1,r1:arr;

    begin

    if i

  • @ 2009-04-13 20:04:05

    看什么哦??????????

  • 1

信息

ID
1099
难度
7
分类
搜索 | 搜索与剪枝 点击显示
标签
递交数
4720
已通过
1012
通过率
21%
被复制
22
上传者