救救我,哪里有问题
  • 板块学术版
  • 楼主lzm13933871057
  • 当前回复6
  • 已保存回复6
  • 发布时间2025/2/4 14:09
  • 上次更新2025/2/4 19:10:47
查看原帖
救救我,哪里有问题
1499401
lzm13933871057楼主2025/2/4 14:09
#include<bits/stdc++.h> 
using namespace std;
int f[2]={11,21 };
int a[25*2500+1],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-1)>=2){
				cout<<w<<":"<<l<<endl;
				w=l=0;
			}
		}
		cout<<w<<";"<<l<<endl;
		cout<<endl;
	}
	return 0;
}

题目:p1042

2025/2/4 14:09
加载中...