讨论 / ??!
740448839 2010-08-17 20:10:00
点我顶贴 收藏 删除
题目:表达式的转换

状态: Unaccepted

测评机: Xeost[5]

得分: 20分

提交日期: 2010-8-18 8:59:00

有效耗时: 110毫秒

测试结果1: 通过本测试点|有效耗时63ms

测试结果2:

测试结果3:

测试结果4:

测试结果5:

测试结果6:

测试结果7:

测试结果8:

测试结果9: [RQNOJ1]通过本测试点|有效耗时63ms[/RQNOJ1][RQNOJ2]测试结果错误.错误结果为:5 7 8 + 9 * - 6 5 2 - / + 5 15 9 * - 6 5 2 - / +

测试结果10: 测试结果错误.错误结果为:7 8 + 9 *

15 9 * </tr>

<tr>

<td valign="top">提交代码:</td>

<td><pre class="brush: delphi">program change;

const

maxn=30000;

var

lat,zhan:array [0..maxn] of char;

ap,zp,l,i,sp,mp:longint;

s:array [0..maxn] of longint;

mid:string;

ch:char;

flag:boolean;

t,w:integer;

function jud(x,y:char):char;

begin

case x of

'+','-' : if (y='@') or (y='(') then jud:='>'

else jud:='<';

'*','/' :if (y='@') or (y='+') or (y='-') or (y='(') then jud:='>'

else jud:='<';

'^' : jud:='>';

')' :if y='(' then jud:='='

else jud:='<';

'(' :jud:='>'

end ;

end;

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

var

i:integer;

tmp:longint;

begin

tmp:=1;

for i:=1 to y do

tmp:=tmp*x;

fang:=tmp;

end;

begin

readln(mid);

zhan[0]:='@';

l:=length(mid);

ap:=0;

zp:=0;

for mp:=1 to l do

begin

ch:=mid[mp];

if (ord(ch)>=48) and (ord(ch)<=57) then

begin

inc(ap);

lat[ap]:=ch;

end

else if jud(ch,zhan[zp])='>' then

begin

inc(zp);

zhan[zp]:=ch;

end

else if jud(ch,zhan[zp])='<' then

begin

while jud(ch,zhan[zp])='<' do

begin

inc(ap);

lat[ap]:=zhan[zp];

dec(zp);

end;

if jud(ch,zhan[zp])='>' then

begin

inc(zp);

zhan[zp]:=ch;

end

else dec(zp)

end

else

dec(zp);

end;

while zp<>0 do

begin

inc(ap);

lat[ap]:=zhan[zp];

dec(zp);

end;

for i:=1 to ap-1 do

write(lat[i],' ');

write(lat[ap]);

writeln;

fillchar(s,sizeof(s),0);

sp:=0;

for i:=1 to l do

begin

flag:=false;

ch:=lat[i];

case ch of

'0'..'9' :

begin

inc(sp);

val(ch,s[sp],t);

end;

'+' :begin

dec(sp);

s[sp]:=s[sp]+s[sp+1];

flag:=true;

end;

'-' :begin

dec(sp);

s[sp]:=s[sp]-s[sp+1];

flag:=true;

end;

'*' :begin

dec(sp);

s[sp]:=s[sp]*s[sp+1];

flag:=true;

end;

'/' :begin

dec(sp);

s[sp]:=s[sp] div s[sp+1];

flag:=true;

end;

'^' :begin

dec(sp);

s[sp]:=fang(s[sp],s[sp+1]);

flag:=true;

end;

end ;

if flag then

begin

write(s[1]);

for w:=2 to sp do

write(' ',s[w]);

for w:=i+1 to l do

write(' ',lat[w]);

writeln;

end;

end;

close(output);

end.</pre></td>

</tr>

</table>

<script type="text/javascript">

SyntaxHighlighter.config.clipboardSwf = 'script/clipboard.swf';

SyntaxHighlighter.all();

</script>

</div>

</div><div id="footer">

Powered By <a href="http://Www.1992y.Com" target="_blank"> RenQing</a> | Developping By <a href="/AboutUser.asp?UID=1564">Wish</a> <a href="http://www.azuis.cn" target="_blank">Azuis</a>

<script src="http://count.rqnoj.cn/count/1/mystat.asp?siteid=57"></script>

<a href="/Help.asp">帮助</a> <a href="/About.asp">关于</a>

<div align="center"><a href="http://www.miibeian.gov.cn" target="_blank">鲁ICP备05014231号</a></div></td>

Processed in 0.0625 second(s).

Copyright (c) 2007-2009 <a href="http://Www.RQNOJ.Cn">Www.RQNOJ.Cn</a>. All Rights Reserved .</td>

</div>

</div>

</BODY></HTML>

这是我的评测结果

我不能理解

2——8 什么都不输出

9包含的内容稀奇古怪

10 竟然有我的源程序!!

WHY!!!!!!!!!!!!!!

#1 oopp1300@2010-08-17 19:17:00
回复 删除
- -

评测机火星了- -

#2 鸣船劲航@2010-08-17 20:10:00
回复 删除
无语

可能是测评机有问题!

查看更多回复
提交回复