讨论 / 这这...!??
420988824 2009-02-27 01:36:00
点我顶贴 收藏 删除
我用了ANSISTRING 全部普通保护错误...

用STRING 过了3个点....

我的程序

program rq051;

var

c:char;

a:ansistring;

i,w,l:integer;

begin

while c<>’E’ do

begin

read(c);

i:=i+1;

a[i]:=c;

end;

i:=0;

repeat

i:=i+1;

if a[i]=’W’ then w:=w+1

else if a[i]=’L’ then l:=l+1

else if a[i]=’E’ then begin writeln(w,’:’,l); break; end;

if (a[i]=’E’)and(i mod 11=0) then begin writeln(’0:0’); break;end;

if ((w>=11)and(l<w-1))or((l>=11)and(w<l-1))

then begin writeln(w,’:’,l); w:=0; l:=0;end;

until a[i]=’E’;

writeln;

i:=0;

w:=0; l:=0;

repeat

i:=i+1;

if a[i]=’W’ then w:=w+1

else if a[i]=’L’ then l:=l+1

else if a[i]=’E’ then begin writeln(w,’:’,l); break; end;

if (a[i]=’E’)and(i mod 21=0) then begin writeln(’0:0’); break;end;

if ((w>=21)and(l<w-1))or((l>=21)and(w<l-1))

then begin writeln(w,’:’,l); w:=0; l:=0;end;

until a[i]=’E’;

end.

大牛指点啊...

状态: Unaccepted

测评机: Xeost[5]

得分: 30分

提交日期: 2009-2-7 9:48:00

有效耗时: 251毫秒

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

测试结果2: 测试结果错误.错误结果为:

正确结果应为:

测试结果3: 测试结果错误.错误结果为:

正确结果应为:

测试结果4: 运行错误|未定义错误编号|错误编号:76

测试结果5: 运行错误|未定义错误编号|错误编号:87

测试结果6: 运行错误|未定义错误编号|错误编号:87

测试结果7: 运行错误|未定义错误编号|错误编号:76

测试结果8: 通过本测试点|有效耗时47:ms

测试结果9: 测试结果错误.错误结果为:118:116

30:31

118:116

30:31

正确结果应为:148:148

148:148

测试结果10: 通过本测试点|有效耗时47:ms

郁闷死我也..

#1 hades@2009-02-27 01:36:00
回复 删除
晾程序喽

var

a:array[1..100000000] of char;

k:longint;

hh,ds:integer;

procedure we(n:integer);

var j:longint;

begin

for j:=1 to k do

begin

case a[j] of

’W’: hh:=hh+1;

’L’: ds:=ds+1;

end;

if ((hh>=n) and (ds<=hh-2)) or ((ds>=n) and (hh<=ds-2))

then begin

writeln(hh,’:’,ds);

ds:=0;

hh:=0;

end;

end;

writeln(hh,’:’,ds);

end;

begin

k:=1;

while a[k-1]<>’E’ do

begin

read(a[k]);

k:=k+1;

end;

we(11);

hh:=0;

ds:=0;

writeln;

we(21);

end.

查看更多回复
提交回复