Uva 12854 - Automated Checking Machine

#include<bits/stdc++.h>
using namespace std;

typedef vector<int>vii;

int main()
{
    vii ek;
    int x,y,i;

    while(cin >> x)
    {
        ek.clear();

        ek.push_back(x);

        for(i=1;i<5;i++)
        {
            cin >> x;
            ek.push_back(x);
        }

        bool f=false;

        for(i=0;i<5;i++)
        {
            cin >> y;

            if(y != ek[i])
            {
                if(!(y | ek[i]))
                {
                    f=true;
                }
            }

            else
            {
                f=true;
            }
        }

        if(f)
        {
            cout << "N\n";
        }

        else
        {
            cout << "Y\n";
        }
    }

    return 0;
}

Comments

Popular posts from this blog

SPOJ-CMG - Collecting Mango

LightOJ 1009 - Back to Underworld

LeetCode Palindrome Number