0分求调
查看原帖
0分求调
1187218
qzm18650661990楼主2024/5/19 21:41

我代码很奇葩,乱写的,别在意

#include<bits/stdc++.h>
using namespace std;
char c;bool a[62555];int len,w_e,w_t,e,t;
int main()
{
  while(cin>>c)
  {
    len++;
    if(c=='W')a[len]=1;
    if(c=='L')a[len]=0;
    if(c=='E'){a[len]=-1;break;}
  }
  for(int i=1;i<=len;i++)
  {
    if(a[i]==1){w_e++;e++;}
    else if(a[i]==0)e++;
    if(e==11)
    {
      cout<<w_e<<":"<<11-w_e<<endl;
      e=w_e=0;
    }
  }
  cout<<w_e<<":"<<e-w_e<<endl<<endl;
  for(int i=1;i<=len;i++)
  {
    if(a[i]==1){w_t++;t++;}
    else if(a[i]==0)t++;
    if(t==21)
    {
      cout<<w_t<<":"<<21-w_t<<endl;
      t=w_t=0;
    }
  }
  cout<<w_t<<":"<<t-w_t;
  return 0;
}
2024/5/19 21:41
加载中...