- 乒乓球
- 2017-08-16 22:05:25 @
原来要一方到11(21)分啊。。
3 条评论
-
MinecraftFuns LV 7 @ 2017-10-05 10:04:59
var i,n,x,y:longint;
a:array[0..1000001]of 0..1;
ch:char;
begin
while ch<>'E' do begin
read(ch);
case ch of
'W':begin inc(n); a[n]:=1;end;
'L':begin inc(n); a[n]:=0;end;
end;
end;
for i:=1 to n do begin
if a[i]=1 then inc(x);
if a[i]=0 then inc(y);
if ((x>=11)or(y>=11))and(abs(x-y)>=2) then begin
writeln(x,':',y);
x:=0; y:=0;
end;
end;
writeln(x,':',y);
writeln;
x:=0; y:=0;
for i:=1 to n do begin
if a[i]=1 then inc(x);
if a[i]=0 then inc(y);
if (abs(x-y)>=2)and((x>=21)or(y>=21)) then begin
writeln(x,':',y);
x:=0; y:=0;
end;
end;
writeln(x,':',y);
end. -
2017-10-04 21:45:12@
#include <iostream>
using namespace std;char a;
char arr[100000];int main() {
a = getchar();
int i = 0;
while (a != 'E') {
arr[i] = a;
i++;
a = getchar();
}
int x = 0, y = 0;
for (int j = 0; j < i; j++) {
if (arr[j] == 'W') {
x++;
}
if (arr[j] == 'L') {
y++;
}
if ((x >= 11) && (y <= x - 2)) {
cout << x << ':' << y << endl;
x = 0;
y = 0;
}
if ((x <= y - 2) && (y >= 11)) {
cout << x << ':' << y << endl;
x = 0;
y = 0;
}
}
cout << x << ':' << y << endl << endl;
x=0;y=0;
for (int j = 0; j < i; j++) {
if (arr[j] == 'W') {
x++;
}
if (arr[j] == 'L') {
y++;
}
if ((x >= 21) && (y <= x - 2)) {
cout << x << ':' << y << endl;
x = 0;
y = 0;
}
if ((x <= y - 2) && (y >= 21)) {
cout << x << ':' << y << endl;
x = 0;
y = 0;
}
}
cout << x << ':' << y;
return 0;
} -
2017-10-04 14:39:33@
。。我也是不懂什么叫11:10要继续比赛,我以为要再开一盘比赛,所以以为最后一次结果要是11:10的话,就要手动补充一个 0:0.
- 1