找大牛纠错 pascal 简单题 郁闷

来源:百度知道 编辑:UC知道 时间:2024/06/01 19:35:05
vijos p1217
描述 Description
华华通过以下方式进行分析,首先将比赛每个球的胜负列成一张表,然后分别计算在11分制和21分制下,双方的比赛结果(截至记录末尾)。
比如现在有这么一份记录,(其中W表示华华获得一分,L表示华华对手获得一分):
WWWWWWWWWWWWWWWWWWWWWWLW
在11分制下,此时比赛的结果是华华第一局11比0获胜,第二局11比0获胜,正在进行第三局,当前比分1比1。而在21分制下,此时比赛结果是华华第一局21比0获胜,正在进行第二局,比分2比1。如果一局比赛刚开始,则此时比分为0比0。
你的程序就是要对于一系列比赛信息的输入(WL形式),输出正确的结果。

输入格式 Input Format
每个输入文件包含若干行字符串(每行至多20个字母),字符串有大写的W、L和E组成,也许中间有若干个空格。其中E表示比赛信息结束,程序应该忽略E之后的所有内容,E后面可能有干扰文字。

输出格式 Output Format
输出由两部分组成,每部分有若干行,每一行对应一局比赛的比分(按比赛信息输入顺序)。其中第一部分是11分制下的结果,第二部分是21分制下的结果,两部分之间由一个空行分隔。

==================================================================
program p1217;
var st:ansistring;
n,j,w,l,i,p:longint;
procedure n11;
begin
for i:=1 to n do
begin
if st[i]='W' then w:=w+1;
if st[i]='L' then l:=l+1;
if ((w>=11) and (w-l>=2)) then begin
writ

program c1217;
var st:ansistring;
l:longint;
f21:array [1..1000000,1..2] of longint;

procedure Init;
var ch:char;
begin
st:='';
while not eof do
begin
read(ch);
if (ch='W') or (ch='L') or (ch='E') then st:=st+ch;
end;
if st[1]='E' then begin writeln(0,':',0); writeln; writeln(0,':',0); halt; end;
l:=length(st)-1;
end;

procedure Love;
var i,t1,t2,h:longint;ch:char;
begin
h:=1;
t1:=0;
t2:=0;
i:=1;
repeat
ch:=st[i];
if ch='W' then begin inc(t1);inc(f21[h,1]); end;
if ch='L' then begin inc(t2);inc(f21[h,2]); end;
if ((t1>=11) or (t2>=11)) and (abs(t1-t2)>1) then
begin writeln(t1,':',t2); t1:=0; t2:=0; end;
if ((f21[h,1]>=21) or (f21[h,2]>=21)) and (abs(f21[h,1]-f21[h,2])>1) then inc(h);
inc(i);
until ch='E';