各位大佬能帮忙看下我很水的代码吗?
查看原帖
各位大佬能帮忙看下我很水的代码吗?
332549
幽灵特工楼主2020/9/10 21:16
#include<bits/stdc++.h>
using namespace std;
int w11=0,l11=0,w21=0,l21=0;
char s;
queue <int> a,b;
int main()
{
	while(!a.empty())a.pop();
	while(!b.empty())b.pop();
    while(1){
    	cin>>s;
    	if(s=='E'){
    		cout<<w11<<":"<<l11<<endl;
    		a.push(w21);
    		b.push(l21);
		}
    	if(s=='W'){
    		w11++;
    		w21++;
		}
		else{
			l11++;
			l21++;
		}
		if(w11==11||l11==11){
			cout<<w11<<":"<<l11<<endl;
			w11=0;
			l11=0;
		}
		if(w21==21||l21==21){
			a.push(w21);
			b.push(l21);
			w21=0;
			l21=0;
		}
	}
	cout<<"\n\n";
	int num=a.size();
	for(int i=0;i<num;i++){
		cout<<a.front()<<":"<<b.front()<<endl;
		a.pop();
		b.pop();
	}
}
2020/9/10 21:16
加载中...