#1 90分救救
查看原帖
#1 90分救救
1168199
leidayu楼主2023/10/25 22:26
#include<iostream>
#include<algorithm>
using namespace std;
int w[2500], l[2500];
int main() {
	char c;
	string s[2502];
	int countw1 = 0, countl1 = 0;
	int countw2=0, countl2 = 0;
	int jc = 0,count=0;

	while (cin >> s[count]) {
		if (s[count].find("E")!=-1){
			break;
		}
		count++;
	}
	for (int k = 0; k <= count;k++) {
		for (int j = 0; j < s[k].size();j++) {
			c = s[k].at(j);
			if (c == 'W') {
				countw1++;
				countw2++;
			}
			else if(c=='L') {
				countl1++;
				countl2++;
			}
			if ((countw1 >= 11 || countl1 >= 11) && abs(countw1 - countl1) > 1) {
				cout << countw1 << ":" << countl1 << endl;
				countl1 = 0;
				countw1 = 0;
			}
			if ((countl2 >= 21 || countw2 >= 21) && abs(countw2 - countl2) > 1) {
				w[jc] = countw2;
				l[jc] = countl2;
				jc++;
				countl2 = 0;
				countw2 = 0;
			}
		}
	}

		cout << countw1 << ":" << countl1 << endl << endl;
		for (int i = 0; i < jc; i++) {
			cout << w[i] << ":" << l[i] << endl;
		}
		cout << countw2 << ":" << countl2;
	}
2023/10/25 22:26
加载中...