20pts求调
查看原帖
20pts求调
1186526
Besheep楼主2024/8/2 22:29
#include <bits/stdc++.h>
using namespace std;
char ss;
string s;


int main() {
	int hh = 0, ds = 0;
	int i = 1;
	while (cin >> ss && ss != 'E') {
		s[i] = ss;
		i++;
	}
	for (int j = 1; j <= i; j++) {
		if (s[j] == 'W')
			hh++;
		if (s[j] == 'L')
			ds++;
		if ((hh >= 11 || ds >= 11) && (hh - ds >= 2 || ds - hh >= 2)) {
			cout << hh << ":" << ds << endl;
			hh = 0;
			ds = 0;
		}
	}
	cout << hh << ":" << ds << endl << endl;
	hh = 0;
	ds = 0;
	for (int j = 1; j <= i; j++) {
		if (s[j] == 'W')
			hh++;
		if (s[j] == 'L')
			ds++;
		if ((hh >= 21 || ds >= 21) && (hh - ds >= 2 || ds - hh >= 2)) {
			cout << hh << ":" << ds << endl;
			hh = 0;
			ds = 0;
		}
	}
	cout << hh << ":" << ds << endl;
	return 0;
}


2024/8/2 22:29
加载中...