AIregister @ 2024-10-12 15:17:02
#include <bits/stdc++.h>
using namespace std;
struct k {
long long w, l;
};
k a[10000001];
k b[10000001];
long long cnt1 = 1;
long long cnt2 = 1;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
char c;
while (1) {
cin >> c;
if (c == 'E') {
break;
}
if (c == 'W') {
a[cnt1].w++;
b[cnt2].w++;
}
if (c == 'L') {
a[cnt1].l++;
b[cnt2].l++;
}
if (a[cnt1].w + a[cnt1].l == 11) {
cnt1++;
}
if (b[cnt2].w + b[cnt2].l == 21) {
cnt2++;
}
}
for (int i = 1; i <= cnt1; i++) {
cout << a[i].w << ":" << a[i].l;
cout << endl;
}
cout << endl;
for (int i = 1; i <= cnt2; i++) {
cout << b[i].w << ":" << b[i].l;
cout << endl;
}
return 0;
}
求条,玄三关
by wdsa1fa @ 2024-10-12 15:25:38
11分制指的是某个人分数达到11以上且两人分差不小于2(题目要求)(21分制同理)
by lsrsrl @ 2024-10-12 15:40:40
#include <bits/stdc++.h>
using namespace std;
int i, w, l;
string a;
char s;
int main() {
while(cin>>s&&s!='E'){
if(s=='W') w++,a+=s;
if(s=='L') l++,a+=s;
if((w>=11||l>=11)&&(w-l>=2||l-w>=2)){
cout<<w<<":"<<l<<endl;
w=0;
l=0;
}
i++;
}
cout<<w<<":"<<l<<endl<<endl;
w=0;l=0;
for(int j;j<=i;j++){
if(a[j]=='W') w++;
if(a[j]=='L') l++;
if((w>=21||l>=21)&&(w-l>=2||l-w>=2)){
cout<<w<<":"<<l<<endl;
w=0;
l=0;
}
}
cout<<w<<":"<<l<<endl<<endl;
return 0;
}
by Wh147258 @ 2024-10-12 15:42:10
@AIregister
哎呦真勤奋
by wdsa1fa @ 2024-10-12 16:04:28
#include<bits/stdc++.h>
using namespace std;
char a[12550000];
long long l=1,i1,i2,h;
bool pt=0;
int main(){
bool pt=0;
while(pt!=1){
scanf(" %c",&a[l]);
if(a[l]=='E'){
pt=1;
}
l++;
}
for(int i=1;i<=l;i++){
if(a[i]=='W') i1++;
if(a[i]=='L') i2++;
if((i1>=11||i2>=11)&&abs(i1-i2)>=2){
printf("%lld:%lld\n",i1,i2);
i1=0;i2=0;
}
}
printf("%lld:%lld\n\n",i1,i2);
i1=0;i2=0;
for(int i=1;i<=l;i++){
if(a[i]=='W') i1++;
if(a[i]=='L') i2++;
if((i1>=21||i2>=21)&&abs(i1-i2)>=2){
printf("%lld:%lld\n",i1,i2);
i1=0;i2=0;
}
}
printf("%lld:%lld\n\n",i1,i2);
return 0;
}
@AIregister