1.3按位AND和按位OR



1.3按位AND和按位OR

Time Limit: 1000 ms  Memory Limit: 65536 KiB

Problem Description

已知长度为n的两个位串a和b,求它们的按位AND和按位OR。

Input

多组测试数据,每组测试数据第1行输入位串长度n(0 < n <= 64),第2行输入n个以空格隔开的取值为0或1的整数表示位串a,第3行输入n个以空格隔开的取值为0或1的整数表示位串b。

Output

每组测试数据占两行,第一行输出n个以空格隔开的取值为0或1的整数表示a位串和b位串的按位AND,第2行输出n个以空格隔开的取值为0或1的整数表示a位串和b位串的按位OR。

Sample Input

5
1 0 0 1 0
0 0 0 1 1

Sample Output

0 0 0 1 0
1 0 0 1 1

Hint

Source

xry-fhf


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

int main()
{
    int a,b,c;
    while(scanf("%d%d%d",&a,&b,&c)!=EOF){
    printf("%d D\n",c);}
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41374539/article/details/80500775