ACM

UVA-12854

 

UVA-12854

 

#include<bits/stdc++.h>

using namespace std;

 

int main()

{

    int a[5], b[5], i;

 

    while(scanf(“%d”, &a[0])==1) {

        for(i = 1; i<5; i++)

            scanf(“%d”, &a[i]);

        for(i = 0; i<5; i++)

            scanf(“%d”, &b[i]);

 

        int flag = 1;

 

        for(i = 1; i<5; i++)

            if(a[i]+b[i] !=1)

                flag = 0;

 

        if(flag==1)

            cout<<“Y\n”;

        else

            cout<<“N\n”;

 

    }

 

 

    return 0;

}

 

Leave a Reply

Your email address will not be published.

five × two =