URI Head or Tail

#include<bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    while(cin >> n)
    {
        if(!n)break;

        int mary=0,john=0;

        for(int i=0;i<n;i++)
        {
            int x;
            cin >> x;
            if(!x)
            {
                mary++;
            }
            else
            {
                john++;
            }
        }

        cout << "Mary won " << mary << " times and John won " << john << " times" << endl;
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number