讨论 / 为什么输出过少?
heyong 2008-03-23 00:17:00
点我顶贴 收藏 删除
var

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

i,k,ss1,ss2:longint;

w1,w2:boolean;

s:char;

begin

k:=0;

for i:=1 to 1000000 do begin

read(s);

if s=E then break

else if (s=W) or (s=L) then begin inc(k); a[k]:=s; end;

end;

w1:=false; w2:=false;

ss1:=0; ss2:=0;

for i:=1 to k do begin

if a[i]=W then inc(ss1)

else inc(ss2);

if (ss1=11)and(abs(ss1-ss2)>=2) then w1:=true;

if (ss2=11)and(abs(ss1-ss2)>=2) then w2:=true;

if w1 or w2 then begin

writeln(ss1,:,ss2);

ss1:=0; ss2:=0;

w1:=false; w2:=false;

end;

if (i=k) and (not w1) and (not w2) then writeln(ss1,:,ss2);

end;

writeln;

w1:=false; w2:=false;

ss1:=0; ss2:=0;

for i:=1 to k do begin

if a[i]=W then inc(ss1)

else inc(ss2);

if (ss1=21)and(abs(ss1-ss2)>=2) then w1:=true;

if (ss2=21)and(abs(ss1-ss2)>=2) then w2:=true;

if w1 or w2 then begin

writeln(ss1,:,ss2);

ss1:=0; ss2:=0;

w1:=false; w2:=false;

end;

if (i=k) and (not w1) and (not w2) then writeln(ss1,:,ss2);

end;

end.

高手看一看啦

查看更多回复
提交回复