Wednesday, 24 June 2015

Keep Rafa at Chelsea ( Dhaka Regional Preliminary 2014 Mock)

/*

Tanzila Islam

CSE, Southeast University.

Dhaka-Bangladesh.

id : https://www.facebook.com/prieontypurnotamohita

mail: tanzilamohita@gmail.com

blog: http://tanzilamohita.blogspot.com/

Contest Question Link :https://algo.codemarshal.org/contests/icpc-2014-pre-mock/problems/H

*/


#include<iostream>

#include<cstdio>

using namespace std;


int main (void) {




    int t=0;

    cin >> t;


    for (int i=1; i<=t; i++) {

            int n;

            cin >> n;


            int canStay=0;

            int deathLimit=3;

            int curDeathLimit=0;


            for (int j=1; j<=n; j++) {

                string line;

                cin >> line;


                if (curDeathLimit < deathLimit) {


                        if (line == "W") curDeathLimit = 0;

                        else if (line == "D" || line == "L") curDeathLimit++;


                        canStay++;

                }

            }


            cout << "Case " << i << ": ";

            if (curDeathLimit<deathLimit) cout << "Yay! Mighty Rafa persists!" << endl;

            else cout << canStay << endl;


    }

}

No comments:

Post a Comment