呜呜

哎 这题调了我一上午 还是只对了8个解。。。(估计是除法的问题 我用的div 不过我实在不想调了!!!)发誓再也不做这种没技术含量的恶心题了!!!
遇到障碍一
)的处理 while循环结束后还要加一个dec!!!
遇到障碍二
get(a,b得属于int64!!!)
遇到障碍三
num sign数组开小了。。。
哎 我的正确率就这样没了

2 条评论

  • @ 2013-08-24 00:23:29

    没有么 那我就不知道哪儿有问题了。。。
    var s,t:array[0..26]of string;
    yes:array[0..26]of boolean;
    n,k,m,x,y,z:longint;
    function priority(c:char):integer;
    var b:integer;
    begin
    if c='^' then b:=8
    else if c='*' then b:=4
    else if c='/' then b:=4
    else if c='+' then b:=2
    else if c='-' then b:=2
    else if c='(' then b:=0
    else if c='@' then b:=-1;
    priority:=b;
    end;
    function get(a,b:int64;c:char):int64;
    var q,p:longint;
    begin
    if c='^' then begin p:=1; for q:=1 to a do p:=p*b;get:=p;end
    else if c='*' then get:=b*a
    else if c='/' then get:=b div a
    else if c='+' then get:=b+a
    else if c='-' then get:=b-a;
    end;
    function scan(sss:string):int64;
    var i,j,l,ntop,stop:longint;
    c1,c2,c3:int64;
    c:char;
    num:array[0..1000]of int64;//
    sign:array[0..1000]of char;
    begin
    l:=length(sss);
    for i:=1 to l do begin num[i]:=0;sign[i]:=' 'end;
    num[0]:=-1;
    sign[0]:='@';stop:=0;
    i:=1;ntop:=0;
    c:=sss[i];
    while c<>'@' do
    begin
    if c in ['0'..'9'] then
    begin inc(ntop); num[ntop]:=ord(c)-ord('0');inc(i);c:=sss[i];
    while c in ['0'..'9'] do
    begin num[ntop]:=num[ntop]*10+ord(c)-ord('0');
    inc(i);c:=sss[i];
    end;
    dec(i);c:=sss[i];
    end
    else if c in ['^','*','/','+','-'] then
    begin
    while priority(c)<=priority(sign[stop]) do
    begin
    c1:=num[ntop];dec(ntop);
    c2:=num[ntop];
    c3:=get(c1,c2,sign[stop]);
    dec(stop); num[ntop]:=c3;
    end;
    inc(stop);sign[stop]:=c;
    end
    else if c='(' then
    begin inc(stop);sign[stop]:=c;end
    else if c=')' then begin
    while sign[stop]<>'(' do
    begin
    c1:=num[ntop];dec(ntop);
    c2:=num[ntop];c3:=get(c1,c2,sign[stop]);
    dec(stop);num[ntop]:=c3;
    end; dec(stop)end;//
    inc(i);c:=sss[i];
    end;
    while stop>0 do
    begin c1:=num[ntop];dec(ntop);
    c2:=num[ntop];
    c3:=get(c1,c2,sign[stop]);
    dec(stop);num[ntop]:=c3; end;
    scan:=num[1];
    end;
    begin
    readln(s[0]); s[0]:=s[0]+'@'; t[0]:=s[0]; yes[0]:=true;
    readln(n);
    for m:=1 to n do
    begin readln(s[m]);s[m]:=s[m]+'@';t[m]:=s[m];yes[m]:=true; end;
    for k:=0 to 9 do
    for m:=0 to n do
    if yes[m] then
    begin s[m]:=t[m];x:=length(s[m]);
    for y:=1 to x do
    if s[m,y]='a' then
    s[m,y]:=chr(k+ord('0'));
    if scan(s[m])=scan(s[0]) then yes[m]:=true
    else begin yes[m]:=false; end;
    end;
    for m:=1 to n do
    if yes[m] then write(chr(m-1+ord('A')));
    end.

    这是我的源程序

  • @ 2013-08-22 12:46:41

    哪里有除法

  • 1

信息

ID
1003
难度
7
分类
字符串 点击显示
标签
递交数
7413
已通过
1550
通过率
21%
被复制
50
上传者