本人蒟蒻,求dalao帮忙康代码
查看原帖
本人蒟蒻,求dalao帮忙康代码
907440
HomelessMan楼主2023/7/29 21:55
#include<iostream>
#include<string.h>
#include<cmath>
using namespace std;
int shiyi(int x,int y,int  bf){
	if(x>=bf-1&&y>=bf-1&&abs(x-y)>=2) return 1?x>y:0;
	if(x==bf) return 1;
	if(y==bf) return 0;
	return -1;
}
int main(){
	bool sf[100001]={};
	int n;
	memset(sf,sizeof(sf),1);
	for(int i=0;;i++){
		char a=getchar();
		if(a=='E') break;
		if(a=='W') sf[i]=1;
		else sf[i]=0;
		n=i;
	}
	int w=0,l=0,sy;
	cout<<endl;
	for(int i=0;i<n;i++){
		if(sf[i]==1) w++;
		else l++;
		if((w>=11||l>=11)&&abs(w-l)>=2){
			cout<<w<<':'<<l<<endl;
			w=l=0;
			continue;
		}
	}
	if(w+l!=0){
		cout<<w<<':'<<l<<endl;
	}
	w=l=0;
	cout<<endl;
	for(int i=0;i<n;i++){
		if(sf[i]==1) w++;
		else l++;
		if((w>=21||l>=21)&&abs(w-l)>=2){
			cout<<w<<':'<<l<<endl;
			w=l=0;
			continue;
		}
	}
	if(w+l!=0){
		cout<<w<<':'<<l<<endl;
	}
	w=l=0;
	return 0;
}
2023/7/29 21:55
加载中...