Uva 12279 Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, i, c = 0, j = 0;
    while(cin >> n && n > 0)
    {
        j++;
        int a[n], x = 0, y = 0;
        for(i=0;i<n;i++)
        {
            cin >> a[i];
            if(a[i] == 0)
                x++;
            else
                y++;
        }
        c = y - x;

        cout << "Case " << j << ": " << c << endl;
    }
    return 0;
}

Comments