Aaryan, Subsequences And Great XOR

QUESTION

Aaryan went to school like any usual day, The teacher asked his crush the following question. Given an array of numbers, First she had to compute the XOR of all the subsequences that can be formed. Suppose each subsequence had their following XOR value that came out after computing -> {P[0], P[1], P[2], and so on upto P[2^n-1] subsequences in an array of n numbers}\n\nNow, the resultant answer is computed by taking bitwise inclusive OR of all P[i]’s\n\nSince, Aaryan wants to impress his crush, He wants to compute the answer for this problem but since he is not so good at it, he turned to you for help.\n\nInput:\nFirst line will consist of number N.\nThen in the next line, there will be N numbers, ith number in the line is denoted by A[i]\n\nOutput:\nOutput the required value as answer.\n\nConstraints:\n1 <= N <= 10^6\n0 <= A[i] <= 10^9.

gta 5 crack version for pc
davinci resolve download crackeado
ez check printing license code
utorrent

ANSWER

#include <stdio.h>
#define getcx getchar_unlocked
#define putcx putchar_unlocked
 inline long long int input()
 {
    long long int n=0;
    char ch=getcx();
    while( ch < '0' || ch > '9' )
    {
        ch=getcx();
    }
    while(  ch >= '0' && ch <= '9' )
    {
        n = (n<<3)+(n<<1) + ch-'0', ch=getcx();
    }
    return n;
  }
inline void output(long long int n)
{
    char a[35];
	long long int i=0;
	do
	{
		a[i++]=n%10+48;
		n=n/10;
	}while(n!=0);
	--i;
	while(i>=0)
	putcx(a[i--]);
	putcx(' ');
}
int main()
{
    long long int n;
    int a,ans=0;
    n=input();
    while(n--)
    {
    	a=input();
    	ans|=a;
    }
    output(ans);
    return 0;
}
Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
CHP Adblock Detector Plugin | Codehelppro