80分,求助
查看原帖
80分,求助
785545
lcx666_76楼主2024/6/24 20:07
#include <iostream>
#include <cmath>
using namespace std;

char s;
long long b[10000001][2];//11分制
long long a[10000001][2];//21分制
long long w,l,i,j,r,t,temp=0,tempp=0;

int main(){
	while(s!='E'){
		cin>>s;
		if(s=='W'){  //记录华华得分 
			w++;
			i++;
			j++;
			r++;
		}
		else{        //记录对手得分 
			l++;
			i++;
			j++;
			t++;
		}
		if((w>=11 or l>=11) and abs(w-l)>=2){   //11分制判断 
			b[tempp][0]=w;
			b[tempp][1]=l;
			w=0;
			l=0;
			i=0;
			tempp++;
		}
		if((r>=21 or t>=21) and abs(r-t)>=2){   //21分制判断
			a[temp][0]=r;
			a[temp][1]=t;
			r=0;
			t=0;
			j=0;
			temp++;
		}
	}
	//cout<<tempp<<endl;
	//cout<<i<<endl;
	if(i!=1){
		b[tempp][0]=w;  //不完全1局 
		b[tempp][1]=l-1;
		for(int k=0;k<=tempp;k++){
			cout<<b[k][0]<<':'<<b[k][1]<<endl;
		}
	}
	else{
		for(int k=0;k<=tempp-1;k++){   //去尾 
			cout<<b[k][0]<<':'<<b[k][1]<<endl;
		}
	}
	cout<<endl;
	//cout<<temp<<endl;
	//cout<<j<<endl;
	if(j!=1){
		a[temp][0]=r;  //不完全1局 
		a[temp][1]=t-1;
		for(int k=0;k<=temp;k++){
			cout<<a[k][0]<<':'<<a[k][1]<<endl;
		}
	}
	else{
		for(int k=0;k<=temp-1;k++){   //去尾 
			cout<<a[k][0]<<':'<<a[k][1]<<endl;
		}
	}
    return 0;
}

80分,求助

2024/6/24 20:07
加载中...