并非很顺利
2024-01-25 16:04:47
发布于:广东
3阅读
0回复
0点赞
#include <iostream>
using namespace std;
int main() {
char c;
int w = 0, l = 0;
int rc[25*2500] = {};
int n = 0;
int policy[2] = {11, 21};
while(cin >> c) {
if(c!='E') {
if(c == 'W')
rc[n++] = 1;
if(c == 'L')
rc[n++] = 0;
} else {
break;
}
}
for(int pi=0; pi<2; pi++) {
w = 0;
l = 0;
for(int i=0; i<n; i++) {
if(rc[i] == 1) {
w++;
} else if (rc[i] == 0) {
l++;
}
if((w>=policy[pi] or l>=policy[pi]) && abs(w-l)>=2) {
cout << w << ":" << l << endl;
w = 0;
l = 0;
}
}
cout << w << ":" << l << endl;
if(pi == 0)
cout << endl;
}
return 0;
}
这里空空如也
有帮助,赞一个