此外,#6也是如此(自己下载下来就AC了,一交上去就WA了)
——神奇洛谷——
bug?(×)特性!(√)
真抽象。。。
by xhbwy001 @ 2024-02-02 15:20:27
```cpp
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
bool n[25*2501+10];
int main()
{
int a;
for(int i=0;1;i++)
{
char tmp;
cin>>tmp;
if(i==0&&tmp=='E')
{
cout<<"0:0"<<endl<<endl<<"0:0";
break;
}
if(tmp=='W')
n[i]=1;
else if(tmp=='L') n[i]=0;
else
{
a=i;
break;
}
}
int w=0,l=0;
// cout << a << endl;
for(int i=0;i<a;i++)
{
// cout << a << endl;
if(n[i]==1) w++;
else l++;
if(w>=11||l>=11)
if(w-l>=2||l-w>=2)
{
cout<<w<<":"<<l<<endl;
w=0;
l=0;
}
if(i==a-1)
{
cout<<w<<":"<<l<<endl;
w=0;
l=0;
}
// cout<<"w"<<w<<"l"<<l<<endl;
// cout << i << endl;
}
cout<<endl;
for(int i=0;i<a;i++)
{
if(n[i]==1) w++;
else l++;
if(w>=21||l>=21)
if(w-l>=2||l-w>=2)
{
cout<<w<<":"<<l<<endl;
w=0;
l=0;
}
if(i==a-1)
{
cout<<w<<":"<<l<<endl;
w=0;
l=0;
}
}
return 0;
}
```
**不做解释**
by MoonRises @ 2024-02-02 19:59:31
```
#include<bits/stdc++.h>
using namespace std;
char str[100010];
int cnt=0;
void show(int n){
int a=0,b=0;
for(int i=0;i<cnt;i++){
if(str[i]=='W') a++;
if(str[i]=='L') b++;
if((a>=n || b>=n) && abs(a-b)>=2){
cout<<a<<":"<<b<<endl;
a=0;b=0;
}
}
cout<<a<<":"<<b<<endl;
}
int main(){
char ch;
while(cin>>ch && ch!='E'){
if(ch=='W' || ch=='L'){
str[cnt++]=ch;
}
}show(11);cout<<endl;show(21);
return 0;
}
```
这样不简单吗?
by SHUYONGRUI @ 2024-02-03 09:14:04