90pts求助!悬赏关注!
查看原帖
90pts求助!悬赏关注!
667452
Null_in_null楼主2023/10/7 21:24
#include<bits/stdc++.h>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cerrno>
#include<clocale>
#include<cmath>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<utility>
#include<vector>
#include<cwchar>
#include<cwctype>
#include<complex.h>
#include<fenv.h>
#include<inttypes.h>
#include<stdbool.h>
#include<stdint.h>
#include<tgmath.h>
using namespace std ;

struct stu{
	bool win ;
	stu *next ;
} *head , *p , *q , *h ;

int main () {
	int l , r ;
	l = 0 ;
	r = 0 ;
	head = new stu ;
	p = head ;
	q = head ;
	h = head ;
	char a ;
	while ( ( a = getchar() ) != EOF && a != 'E' ) {
		if ( a == '\n' || a == '\r' || a == ' ' ) {
			continue ;
		}
		p->next = nullptr ;
		if ( a == 'W' ) {
			p->win = true ;
		}
		if ( a == 'L' ) {
			p->win = false ;
		}
		q = p ;
		p = new stu ;
		q->next = p ;
	}
	if ( p == head ) {
		cout << "0:0\n\n0:0" ;
		return 0 ;
	}
	while ( h->next != nullptr ) {
		if ( h->win ) {
			l++ ;
			if ( l >= 11 && l - r >= 2 ) {
				cout << l << ":" << r << endl ;
				l = 0 ;
				r = 0 ;
			}
		}
		else {
			r++ ;
			if ( r >= 11 && r - l >= 2 ) {
				cout << l << ":" << r << endl ;
				l = 0 ;
				r = 0 ;
			}
		}
		h = ( h->next ) ;
	}
	if ( l || r ) {
		cout << l << ":" << r << endl ;
	}
	l = 0 ;
	r = 0 ;
	cout << endl ;
	h = head ;
	while ( h->next != nullptr ) {
		if ( h->win ) {
			l++ ;
			if ( l >= 21 && l - r >= 2 ) {
				cout << l << ":" << r << endl ;
				l = 0 ;
				r = 0 ;
			}
		}
		else {
			r++ ;
			if ( r >= 21 && r - l >= 2 ) {
				cout << l << ":" << r << endl ;
				l = 0 ;
				r = 0 ;
			}
		}
		h = ( h->next ) ;
	}
	if ( ! ( l || r ) ) {
		return 0 ;
	}
	cout << l << ":" << r << endl ;
	return 0 ;
}

2023/10/7 21:24
加载中...