liumoumou_haha @ 2024-08-23 11:28:43
#include<bits/stdc++.h>
using namespace std;
int f[2]={11,21};
int a[25*2500+10],n=0;//两种赛制的获胜得分
int main()
{
char tmp;
while(1)
{
cin>>tmp;//不断读入结果
if(tmp=='E') break;
else if(tmp=='W') a[n++]=1;//华华赢
else if(tmp=='L') a[n++]=0 ;//华华输
}
for(int k=0;k<2;k++)//两种赛制循环
{
int w=0,l=0;
for(int i=0;i<n;i++)
{
w+=a[i];
l+=1-a[i];
if(max(w,l)>=f[k]&&abs(w-l)>=2)
{
cout<<w<<": "<<l<<endl;
w=l=0;
}
cout<<w<<": "<<l<<endl;
cout<<endl;
}
}
return 0;
}
by zxz114514 @ 2024-08-23 11:30:40
@liumoumou_haha ```
using namespace std; int win[62503]; int w,l; int main() { char s; for(int i=1;cin>>s&&s!='E';i++) { if(s=='W')win[i]=1; else win[i]=2; } for(int i=1;1;i++) { if(win[i]==1)w++; if(win[i]==2)l++; if(win[i]==0) { cout<<w<<":"<<l<<endl<<endl; break; } if(w-l>=2||l-w>=2) if(w>=11||l>=11) { cout<<w<<":"<<l<<endl; w=0; l=0; } } w=0; l=0; for(int i=1;1;i++) { if(win[i]==1)w++; if(win[i]==2)l++; if(win[i]==0) { cout<<w<<":"<<l; break; } if(w-l>=2||l-w>=2) if(w>=21||l>=21) { cout<<w<<":"<<l<<endl; w=0; l=0; } } return 0; }
by AI9527 @ 2024-08-23 11:30:55
@liumoumou_haha 已调,求关
#include<bits/stdc++.h>
using namespace std;
int f[2]={11,21};
int a[25*2500+10],n=0;
int main()
{
char tmp;
while(1)
{
cin>>tmp;
if(tmp=='E') break;
else if(tmp=='W') a[n++]=1;
else if(tmp=='L') a[n++]=0 ;
}
for(int k=0;k<2;k++)
{
int w=0,l=0;
for(int i=0;i<n;i++)
{
w+=a[i];
l+=1-a[i];
if(max(w,l)>=f[k]&&abs(w-l)>=2)
{
cout<<w<<":"<<l<<endl;
w=l=0;
}
}
cout<<w<<":"<<l<<endl;
w=l=0;
cout<<endl;
}
return 0;
}
by hhztl @ 2024-08-23 11:31:05
@liumoumou_haha 你把
cout<<w<<": "<<l<<endl;
cout<<endl;
去掉,在for(int i=0;i<n;i++)
外面加换行
by 13986586309hap @ 2024-08-23 15:13:22
#include <bits/stdc++.h>
using namespace std;
char a;
string s;
long long w=0,l=0,i=0;
int main()
{
while(cin >> a && a!='E'){
if(a=='W'){w++;s+=a;}
if(a=='L'){l++;s+=a;}
if((w>=11 || l>=11) && abs(w-l)>=2){
cout << w << ':' << l << endl;
w=0,l=0;
}
i++;
}
cout << w << ':' << l << endl << endl;
w=0;l=0;
for(int j=0;j<=i;j++){
if(s[j] == 'W') w++;
if(s[j] == 'L') l++;
if((w>=21 || l>=21) && abs(w-l)>=2){
cout << w << ':' << l << endl;
w=0;l=0;
}
}
cout << w << ':' << l;
return 0;
}