第一个点为什么过不了(求大神)

var
ch:char;
n,i,x,y,k:longint;
a:array[1..1000000000] of char;
begin
repeat
read(ch);
if (ch='W') or (ch='L') then begin
inc(n);
a[n]:=ch;
end;
until ch='E';
x:=0;
y:=0;
k:=0;
repeat
inc(k);
if a[k]='W' then inc(x);
if a[k]='L' then inc(y);
if (x=11) and (x>y) and (x-y>=2) then begin
writeln(x,':',y);
x:=0;
y:=0;
end;
if (y=11) and (y>x) and (y-x>=2) then begin
writeln(x,':',y);
x:=0;
y:=0;
end;
if (x>11) and (x>y) and (x-y>=2) then begin
writeln(x,':',y);
x:=0;
y:=0;
end;
if (y>11) and (y>x) and (y-x>=2) then begin
writeln(x,':',y);
x:=0;
y:=0;
end;
if k=n then begin
writeln(x,':',y);
end;
until k=n;
writeln;
k:=0;
x:=0;
y:=0;
repeat
inc(k);
if a[k]='W' then inc(x);
if a[k]='L' then inc(y);
if (x=21) and (x>y) and (x-y>=2) then begin
writeln(x,':',y);
x:=0;
y:=0;
end;
if (y=21) and (y>x) and (y-x>=2) then begin
writeln(x,':',y);
x:=0;
y:=0;
end;
if (x>21) and (x>y) and (x-y>=2) then begin
writeln(x,':',y);
x:=0;
y:=0;
end;
if (y>21) and (y>x) and (y-x>=2) then begin
writeln(x,':',y);
x:=0;
y:=0;
end;
if k=n then begin
writeln(x,':',y);
end;
until k=n;
end.

1 条评论

  • @ 2016-09-13 12:33:47

    var x:char;
    a,b,c,d:array[1..5000]of longint;
    t,s,i:longint;
    begin
    t:=1;
    s:=1;
    x:='1';
    fillchar(a,sizeof(a),0);
    b:=a;
    c:=b;
    d:=c;
    while x<>'E' do
    begin
    read(x);
    if x='E' then break;
    if x='W' then begin
    inc(a[t]);
    inc(c[s]);
    end;
    if x='L' then begin
    inc(b[t]);
    inc(d[s]);
    end;
    if ((a[t]>=11)or(b[t]>=11))and(abs(b[t]-a[t])>=2) then
    inc(t);
    if ((c[s]>=21)or(d[s]>=21))and(abs(c[s]-d[s])>=2) then
    inc(s);
    end;
    for i:=1 to t do
    writeln(a[i],':',b[i]);
    writeln;
    for i:=1 to s do
    writeln(c[i],':',d[i]);
    end.

  • 1

信息

ID
1217
难度
7
分类
字符串 点击显示
标签
递交数
18619
已通过
4248
通过率
23%
被复制
33
上传者