Luo Gu P1042 Table Tennis

https://www.luogu.org/problem/P1042

 

#include <bits / STDC ++ H.>
 the using  namespace STD;
 int win [ 62 503 ];
 int W, L;
 int main () {
     char S;         // because all single character, so use char 
    for ( int I = . 1 ; S = S && >> CIN! ' E ' ; I ++) { // cycle is read, when the read character E the end of the 
        iF (S == ' W is ' ) win [I] = . 1 ;      // . 1 represents a win, 2 denotes a negative 
        the else win [I] = 2 ; 
    } 
    // out first sub-system 11 
    for (int I = . 1 ; . 1 ; I ++ ) {
         IF (win [I] == . 1 ) 
            W ++; // wins + 1 
        IF (win [I] == 2 ) 
            L ++; // negative field +1 
        IF (win [I] == 0 ) { // read 0 recording end, the score before the end of output records. 
            << << W COUT " : " << L << endl << endl; 
            W = 0 ; 
            L = 0 ;   // Clear 
            BREAK ; 
        }
        IF ((WL> = 2 || LW> = 2 ) && (W> = 11 || L> = 11 )) { // when two scores differ by more than 2 and one large fraction equal to 11 output 
            cout << w << " : " << L << endl; 
            W = 0 ; // score clears 
            L = 0 ; 
        } 
    } 
    // 21 is made of points 
    for ( int I = . 1 ; . 1 ; I ++ ) {
         IF (win [I] == . 1 ) W ++ ;
         IF (win [I] == 2)l++;
        if(win[i]==0) {
            cout<<w<<":"<<l;
            break;
        }
        if(w-l>=2||l-w>=2)
            if(w>=21||l>=21) {
                cout<<w<<":"<<l<<endl;
                w=0;
                l=0;
            }
    }
    return 0;
}

 

Guess you like

Origin www.cnblogs.com/QingyuYYYYY/p/11704966.html